LeetCode
Rusty-Trueno
北京邮电大学计算机学院研究生在读
展开
-
28. Implement strStr()
一、Description: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: 2Ex...原创 2018-03-06 21:14:51 · 120 阅读 · 0 评论 -
21. Merge Two Sorted Lists
一、Description: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->4O...原创 2018-03-06 16:52:42 · 157 阅读 · 0 评论 -
20. Valid Parentheses
一、Description: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" ...原创 2018-03-06 16:20:28 · 134 阅读 · 0 评论 -
67. Add Binary
一、Description: Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".二、Ideas: 这道题的目的是计算两个字符串所表示的二进制数字之和(也是二进制字符串表示)。先判断出两个字符串的长短,之后,按a长还是b长分情况...原创 2018-03-07 21:02:40 · 131 阅读 · 0 评论 -
66. Plus One
一、Description: 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 it...原创 2018-03-07 20:03:07 · 133 阅读 · 0 评论 -
58. Length of Last Word
一、Description: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 wor...原创 2018-03-07 19:20:47 · 161 阅读 · 0 评论 -
53. Maximum Subarray
一、Description: 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 [...原创 2018-03-07 17:00:39 · 156 阅读 · 0 评论 -
38. Count and Say
一、Description: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 ...原创 2018-03-07 10:17:48 · 146 阅读 · 0 评论 -
35. Search Insert Position
一、Description: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 ...原创 2018-03-07 08:17:19 · 146 阅读 · 0 评论 -
15.3Sum(python)
1.Description:Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solutio...原创 2019-06-20 11:46:20 · 287 阅读 · 0 评论