- 博客(7)
- 收藏
- 关注
原创 167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers
2017-01-21 11:18:16 186
原创 162. Find Peak Element
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its index. The array may contain multiple peaks, in
2017-01-21 11:15:44 138
原创 165. Compare Version Numbers
Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 You may assume that the version strings are non-empty and contain only digits and the . character.
2017-01-21 11:13:59 155
原创 152. Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the largest pr
2017-01-11 14:15:56 157
原创 151. Reverse Words in a String
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". 先整个翻转,再单个单词翻转,有意思的是需要考虑各种边界问题。DISCUSS里面最高排名的代码我开始竟没有看懂…… void rever
2017-01-10 21:49:40 180
原创 139. Word Break
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may ass
2017-01-05 22:22:00 140
原创 141. Linked List Cycle&142. Linked List Cycle II
Given a linked list, determine if it has a cycle in it. class Solution { public: bool hasCycle(ListNode *head) { if(head==NULL) return 0; ListNode *fast=head;
2017-01-05 22:15:10 162
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人