06 2018 档案
摘要:58. Length of Last Word Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the
阅读全文
摘要:53. Maximum Subarray Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return i
阅读全文
摘要:38. Count and Say The count-and-say sequence is the sequence of integers with the first five terms as following: class Solution {public: string countA
阅读全文
摘要:35. Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would b
阅读全文
摘要:28. Implement strStr() Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 解题思路: 1)判断needle字符串长度,
阅读全文
摘要:27. Remove Element Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra s
阅读全文
摘要:26. Remove Duplicates from Sorted Array Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return t
阅读全文
摘要:21. Merge Two Sorted Lists Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of th
阅读全文
摘要:14. Longest Common Prefix 解题思路: 1)判断字符串组长度,长度为0以及1时,分别返回相应的值。 2)字符串组长度超过1时,以第一个字符串每个位置的字符为基准,比较后面每个字符串同样位置的字符是否与第一个字符串相同。若相同则继续比较直到第一个字符串结束,然后返回第一个字符串
阅读全文
摘要:20. Valid Parentheses 解题思路: 1)将'(' , '[' , '{' 压入栈; 2)判断栈顶元素是否可以和之后出现的第一个非 1)中的元素匹配。若匹配,则去弹出此时的栈顶元素,反之返回false。例如现在栈顶元素为'(' ,若接下来出现的第一个非 1)中元素为 ')' ,则匹
阅读全文

浙公网安备 33010602011771号