- 博客(12)
- 收藏
- 关注
转载 Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”, with the le
2017-12-24 09:33:14 142
转载 Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it
2017-12-23 15:51:50 139
转载 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 string.If the last word does not exist, return 0.Note: A word is defined as
2017-12-23 11:14:18 125
原创 Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the
2017-12-23 10:56:25 165
原创 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.Examp
2017-12-23 09:37:09 132
转载 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. 将两个已经排好序的链表合并成一个有序链表/** * Definition for singly-linked li
2017-12-21 11:50:21 174
转载 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 valid but “
2017-12-21 10:53:15 139
原创 Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 讲一个输入的罗马数字变成相应的整数。 首先要知道每一个罗马数字代表与组成含义。public int romanInput(String s){ int nums[] =
2017-12-20 17:57:41 121
原创 Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. 就是找一个字符串数组的公共最长前缀。先上代码 public static String longestCommonPrefix(String[] strs) { if(strs.length==0){
2017-12-20 17:54:58 199
原创 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, note the restriction of using extra space.You could also try reversing an integer.
2017-11-22 17:40:23 298
转载 Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer. Example 1:Input: 123 Output: 321 Example 2:Input: -123 Output: -321 Example 3:Input: 120 Output: 21 Note: Assume we are dealing wit
2017-11-22 10:58:59 181
转载 LeetCode第一题
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 same element twice.
2017-11-20 16:39:45 255
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人