摘要:
459. Repeated Substring Pattern Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of t 阅读全文
posted @ 2017-04-09 21:55
蓦然闻声
阅读(97)
评论(0)
推荐(0)
摘要:
53. Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the a 阅读全文
posted @ 2017-04-09 21:54
蓦然闻声
阅读(141)
评论(0)
推荐(0)
摘要:
326. Power of Three Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / rec 阅读全文
posted @ 2017-04-09 21:53
蓦然闻声
阅读(146)
评论(0)
推荐(0)
摘要:
Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文
posted @ 2017-04-09 21:53
蓦然闻声
阅读(96)
评论(0)
推荐(0)
摘要:
405. Convert a Number to Hexadecimal Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method 阅读全文
posted @ 2017-04-09 21:52
蓦然闻声
阅读(193)
评论(0)
推荐(0)
摘要:
415. Add Strings Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 思路:控制num1的长度不小于num2的长度,在n 阅读全文
posted @ 2017-04-09 21:51
蓦然闻声
阅读(114)
评论(0)
推荐(0)
摘要:
108. Convert Sorted Array to Binary Search Tree 思路:利用一个有序数组构建一个平衡二叉排序树。直接递归构建,取中间的元素为根节点,然后分别构建左子树和右子树。 阅读全文
posted @ 2017-04-09 21:51
蓦然闻声
阅读(97)
评论(0)
推荐(0)
摘要:
501. Find Mode in Binary Search Tree Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in 阅读全文
posted @ 2017-04-09 21:50
蓦然闻声
阅读(237)
评论(0)
推荐(0)
摘要:
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 阅读全文
posted @ 2017-04-09 21:49
蓦然闻声
阅读(119)
评论(0)
推荐(0)
摘要:
Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals 阅读全文
posted @ 2017-04-09 21:49
蓦然闻声
阅读(102)
评论(0)
推荐(0)