代码改变世界

LeetCode 64. Minimum Path Sum 20170515

2017-05-15 22:20 by 方小呆dai, 209 阅读, 0 推荐, 收藏,
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文

LeetCode 56. 56. Merge Intervals 20170508

2017-05-08 17:07 by 方小呆dai, 313 阅读, 0 推荐, 收藏,
摘要:Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 题目大意:给出一个区 阅读全文

LeetCode 26. Remove Duplicates from Sorted Array

2017-05-01 20:47 by 方小呆dai, 143 阅读, 0 推荐, 收藏,
摘要: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 fo 阅读全文

LeetCode 24. Swap Nodes in Pairs 20170424

2017-04-24 23:57 by 方小呆dai, 136 阅读, 0 推荐, 收藏,
摘要:Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文

LeetCode 19. Remove Nth Node From End of List 20170417

2017-04-17 14:21 by 方小呆dai, 201 阅读, 0 推荐, 收藏,
摘要:Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in on 阅读全文

LeetCode No.9 Palindrome Number 20170410

2017-04-10 17:57 by 方小呆dai, 166 阅读, 0 推荐, 收藏,
摘要:Determine whether an integer is a palindrome. Do this without extra space. 题目大意:输入一个整数,判断其是否为回文数。不能使用额外空间。 解题思路:由于不能使用额外空间,所以不能把整数变成字符串。由于回文数是正着反着都是一样 阅读全文

LeetCode No.8. String to Integer (atoi) 2017/4/10(补上一周)

2017-04-10 16:24 by 方小呆dai, 173 阅读, 0 推荐, 收藏,
摘要:Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below 阅读全文

LeetCode No.7 Reverse Integer 2017/3/27

2017-03-27 01:58 by 方小呆dai, 147 阅读, 0 推荐, 收藏,
摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers. Note:The input is assumed to be a 3 阅读全文

LeetCode No.4 Median of Two Sorted Arrays 20170319

2017-03-19 20:20 by 方小呆dai, 145 阅读, 0 推荐, 收藏,
摘要:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文

LeetCode No.3 Longest Substring Without Repeating Characters 20170313

2017-03-13 21:12 by 方小呆dai, 158 阅读, 0 推荐, 收藏,
摘要:Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng 阅读全文