leetcode
前端小白的江湖路
这个作者很懒,什么都没留下…
展开
-
1.[easy] 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原创 2017-07-03 17:35:36 · 182 阅读 · 0 评论 -
2.[easy] Reverse Integer
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you thought about this? Here are some good questions to ask before coding. Bonus points for y原创 2017-07-04 10:20:33 · 162 阅读 · 0 评论 -
3.[easy] Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. 判断是否是回文数 先不考虑使用额外空间的问题 最直观的就是转换成字符串首尾比对 1.字符串解法 def is_palindrome(num): if num < 0: return False i = 0原创 2017-07-04 13:49:59 · 212 阅读 · 0 评论 -
4.[easy] remove elements
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 in place with constant memory.原创 2017-07-04 14:46:26 · 344 阅读 · 0 评论 -
5.[easy]Plus one
Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero, except the number 0 itself. The digi原创 2017-08-28 18:33:16 · 308 阅读 · 0 评论 -
6.[Easy] 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.原创 2017-11-04 15:10:52 · 212 阅读 · 0 评论