LeetCode
Elync
这个作者很懒,什么都没留下…
展开
-
LeetCode每日一题(2018-01-11)
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.我的代码: public ListNode mergeTwoLists(ListNode l1, ListNo原创 2018-01-11 16:06:59 · 149 阅读 · 0 评论 -
LeetCode每日一题(2018-01-26)
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] ha原创 2018-01-26 14:20:59 · 264 阅读 · 0 评论 -
LeetCode每日一题(2018-01-25)
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原创 2018-01-25 15:09:51 · 121 阅读 · 0 评论 -
LeetCode每日一题(2018-01-03)
Given a 32-bit signed integer, reverse digits of an integer. 我的代码:class Solution { public int reverse(int x) { String str = String.valueOf(x); StringBuffer sb = new StringBuff原创 2018-01-03 15:40:14 · 151 阅读 · 0 评论 -
LeetCode每日一题(2018-01-08)
Write a function to find the longest common prefix string amongst an array of strings.我的代码:public String longestCommonPrefix(String[] strs) { if(strs.length==0) return ""; if(strs.le原创 2018-01-08 17:09:34 · 164 阅读 · 0 评论 -
LeetCode每日一题(2018-01-24)
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-原创 2018-01-24 14:45:11 · 105 阅读 · 0 评论 -
LeetCode每日一题(2018-01-05)
Determine whether an integer is a palindrome. Do this without extra space.判断是否为回文数。我的代码:class Solution { public boolean isPalindrome(int x) { if(x<0) return false; if(x<10)原创 2018-01-05 15:14:09 · 231 阅读 · 0 评论 -
LeetCode每日一题(2018-01-22)
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 modifyin原创 2018-01-22 14:03:33 · 195 阅读 · 0 评论 -
LeetCode每日一题(2018-01-12)
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-12 16:04:10 · 155 阅读 · 0 评论 -
LeetCode每日一题(2018-01-29)
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原创 2018-01-29 14:18:51 · 143 阅读 · 0 评论