- 博客(15)
- 收藏
- 关注
原创 67. Add Binary —— Java
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".class Solution { public String addBinary(String a, String b) { c
2017-09-04 11:08:20 296
原创 66. Plus One —— Java
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 digits a
2017-09-01 16:21:44 336
原创 58. Length of Last Word —— Java
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is def
2017-09-01 14:29:42 234
原创 38. Count and Say —— Java
The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11 is read
2017-08-30 16:58:22 349
原创 35. Search Insert Position —— Java
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-08-30 15:37:47 222
原创 28. Implement strStr() ——Java
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.寻找haystack里面是否存在needle, 如果没有出现,返回-1.特别注意:1. needle不能比haystac
2017-08-30 15:28:37 179
原创 27. Remove Element —— Java
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.The
2017-08-30 11:26:43 194
原创 26. Remove Duplicates from Sorted Array(从排序数组中删除重复) —— Java
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 in place with
2017-08-30 10:59:34 241
原创 20. Valid Parentheses(有效括号) —— Java
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
2017-08-29 17:16:53 341
原创 14. Longest Common Prefix(最长公共前缀) —— Java
Write a function to find the longest common prefix string amongst an array of strings.Example:Given ["abc","ab","abcd"],return "ab".class Solution { public String longes
2017-08-29 17:13:12 299
原创 13. Roman to Integer —— Java
Given "DCXXI" return 621Given "MCMXCVI" return 1996重复数次:一个罗马数字重复几次,就表示这个数的几倍。右加左减:在较大的罗马数字的右边记上较小的罗马数字,表示大数字加小数字。在较大的罗马数字的左边记上较小的罗马数字,表示大数字减小数字。左减的数字有限制,仅限于I、X、C。比如45不可以写成V
2017-08-29 16:54:17 219
原创 9. Palindrome Number(回文数字 eg:12321) —— Java
Determine whether an integer is a palindrome. Do this without extra space.class Solution { public boolean isPalindrome(int x) { int max = Integer.MAX_VALUE; long verse = 0;
2017-08-29 16:52:47 211
原创 7. Reverse Integer(反转整型) —— Java
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Note:The input is assumed to be a 32-bit signed integer. Your function should return 0 wh
2017-08-29 16:49:38 598
原创 1. Two Sum(两数之和) —— Java
自己刷题,只是为了存下来,别吐槽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, a
2017-08-29 16:41:34 655
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人