- 博客(11)
- 收藏
- 关注
原创 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 be if it were inserted in order. You may assume no duplicates in the array.
2018-01-31 21:23:54 99
原创 28. Implement strStr()
Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Example
2018-01-31 20:27:42 91
原创 27. Remove Element
Given an array and a value, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array in-plac
2018-01-31 17:32:14 100
原创 26.Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by modifying th
2018-01-30 22:18:29 108
原创 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 the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1->1->
2018-01-30 22:15:41 106
原创 20. Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va
2018-01-28 22:49:28 88
原创 14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings."abcdefg""abcdefghijk""abcdfghijk""abcef"上面的字符串数组的最长公共前缀就是"abc"。class Solution {public: string longes
2018-01-28 22:03:35 104
转载 13. Roman to Integer(运行时间有待改进)
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.罗马数字是最古老的数字表示方式,比阿拉伯数组早2000多年,起源于罗马罗马数字有如下符号:基本字符IVXLCD
2018-01-27 23:03:42 135
原创 9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, no
2018-01-27 21:48:56 121
原创 7. Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:
2018-01-26 20:46:26 117
原创 1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the sam
2018-01-26 19:59:52 116
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人