leetcode
my_learning_road
这个作者很懒,什么都没留下…
展开
-
Search Insert Position
35. 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...原创 2018-01-30 20:35:07 · 117 阅读 · 0 评论 -
Linked List Cycle II
题目描述:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up:Can you solve it without using extra space?题目分析: ...原创 2018-03-22 18:08:37 · 150 阅读 · 0 评论 -
Linked List Cycle
题目描述:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?题目分析: 定义两个指针,同时从链表头结点出发,一个指针一次走一步,一个指针一次走两步。如果走的快的指针套圈了走得慢的指针,那么链表是环形表,如果走得快的指针走...原创 2018-03-22 17:13:54 · 105 阅读 · 0 评论 -
Merge Sorted Array
88. Merge Sorted Array描述:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m...原创 2018-03-01 16:55:03 · 140 阅读 · 0 评论 -
Remove Duplicates from Sorted List
83. Remove Duplicates from Sorted List题目描述:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2...原创 2018-03-07 16:03:12 · 99 阅读 · 0 评论 -
Merge Two Sorted Lists(合并两个排序链表)
21. 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.Example:Input: 1->2->4...原创 2018-03-07 15:07:48 · 1550 阅读 · 0 评论 -
Remove Element
27. Remove Element描述: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 ...原创 2018-01-28 15:41:29 · 116 阅读 · 0 评论 -
Valid Parentheses
20. 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 "()...原创 2018-01-27 15:45:12 · 324 阅读 · 0 评论 -
Reverse Integer
题目:7 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注意:Assume we are ...原创 2018-01-24 17:09:25 · 126 阅读 · 0 评论 -
Two Sum
题目:1. Two Sum描述: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...原创 2018-01-24 17:30:43 · 126 阅读 · 0 评论 -
Remove Duplicates from Sorted Array
26. Remove Duplicates from Sorted Array描述: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...原创 2018-01-24 21:49:23 · 78 阅读 · 0 评论 -
Palindrome Number
9. Palindrome Number描述: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 intege...原创 2018-01-25 15:47:21 · 107 阅读 · 0 评论 -
Roman to Integer
13. Roman to Integer描述:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.我的思路: 罗马数字计数规则: 罗马数字采用七个罗马字母作数字、即Ⅰ(1)、X(10)、C(100)、M(1000)、V(5)、L...原创 2018-01-26 15:47:09 · 154 阅读 · 0 评论 -
Implement strStr()
题目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: 2 Example 2:Inpu...原创 2018-03-25 20:35:50 · 118 阅读 · 0 评论