### LeetCode

My LeetCode solution with explanation.

0 已关注
72篇博文
• #### LeetCode[Backtracking]: Subsets

Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset m...

2015-03-23 15:54
779
• #### LeetCode[String]: Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings. 这个题目非常简单，只要弄清...

2015-03-04 17:06
766
• #### LeetCode[stack]: Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. ...

2015-03-04 16:47
640
• #### LeetCode[String]: Valid Number

Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" ...

2015-03-03 15:47
607
• #### LeetCode[Math]: Integer to Roman

Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from ...

2015-03-03 14:46
583
• #### LeetCode[Math]: Roman to Integer

Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from ...

2015-03-03 13:36
612
• #### LeetCode[Tree]: Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the ro...

2015-03-03 00:23
1085
• #### LeetCode[BFS]: Surrounded Regions

Given a 2D board containing ‘X’ and ‘O’, capture all regions surrounded by ‘X’. A region is captu...

2015-03-02 18:29
532
• #### LeetCode[Map]: Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence. ...

2015-03-02 13:14
601
• #### LeetCode[Sort]: Largest Number

LeetCode[Sort]: Largest Number Given a list of non negative integers, arrange them such that they ...

2015-02-17 19:55
627
• #### LeetCode[Linked List]: Reverse Nodes in k-Group

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. I...

2014-11-01 19:53
555
• #### LeetCode[Array]: Remove Element

Given an array and a value, remove all instances of that value in place and return the new length. T...

2014-10-31 00:38
699
• #### LeetCode[Array]: Plus One

Given a non-negative number represented as an array of digits, plus one to the number. The digits a...

2014-10-31 21:08
894
• #### LeetCode[Array]: Merge Sorted Array

Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume th...

2014-10-31 22:19
463
• #### LeetCode[Array]: Pascal's Triangle

Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Retu...

2014-10-31 23:18
660
• #### LeetCode[Linked list]: Rotate List

Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given ...

2014-11-02 12:21
583
• #### LeetCode[Linked List]: Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point t...

2014-11-02 20:17
498
• #### LeetCode[Linked List]: Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head. For example, Give...

2014-11-03 19:25
646