[leetcode]Remove Nth Node From End of List

摘要: Remove Nth Node From End of ListGiven a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2... 阅读全文
posted @ 2014-07-19 16:03 喵星人与汪星人 阅读(217) 评论(0) 推荐(0) 编辑

[leetcode]Linked List Cycle II

摘要: Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without u... 阅读全文
posted @ 2014-07-19 15:36 喵星人与汪星人 阅读(215) 评论(0) 推荐(0) 编辑

[leetcode]Linked List Cycle

摘要: Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?算法思路1:快慢指针,当两个指针相遇,则表示有环,... 阅读全文
posted @ 2014-07-19 14:59 喵星人与汪星人 阅读(293) 评论(0) 推荐(0) 编辑

[leetcode]Palindrome Number

摘要: Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers b... 阅读全文
posted @ 2014-07-17 23:35 喵星人与汪星人 阅读(213) 评论(0) 推荐(0) 编辑

DFS小结

摘要: 这篇博文较长,且理论为主,因为我准备换种风格,以保证大家看的时候不会觉得无聊,看完如果对dfs还是一头雾水,那我也不会请你吃麻辣烫开场:刷了一遍leetcode,发现DFS是个特别强大,且出题率特别高的一个基础算法,第一次接触DFS是树的一个搜索算法,相对而言的是BFS。根据难度与考察频率参考表的建... 阅读全文
posted @ 2014-07-17 23:04 喵星人与汪星人 阅读(448) 评论(0) 推荐(0) 编辑

[leetcode]Reverse Integer

摘要: Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about th... 阅读全文
posted @ 2014-07-17 20:40 喵星人与汪星人 阅读(189) 评论(0) 推荐(0) 编辑

[leetcode]Plus One

摘要: Plus OneGiven a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant dig... 阅读全文
posted @ 2014-07-17 19:43 喵星人与汪星人 阅读(199) 评论(0) 推荐(0) 编辑

[leetcode]Set Matrix Zeroes

摘要: Set Matrix ZeroesGiven amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight... 阅读全文
posted @ 2014-07-17 16:56 喵星人与汪星人 阅读(199) 评论(0) 推荐(0) 编辑

leetcode中关于树的dfs算法题

摘要: Validate Binary Search TreeRecover Binary Search TreeSymmetric TreeSame TreeMaximum Depth of Binary TreeConstruct Binary Tree from Preorder and Inorde... 阅读全文
posted @ 2014-07-16 21:20 喵星人与汪星人 阅读(367) 评论(0) 推荐(0) 编辑

[leetcode]Count and Say

摘要: Count and SayThe count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is r... 阅读全文
posted @ 2014-07-16 20:42 喵星人与汪星人 阅读(395) 评论(0) 推荐(0) 编辑