原创 Word Break

問題描述 Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence o

原创 Sudoku Solver

問題描述 Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character ‘.

原创 Combination Sum III

問題描述 Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be

原创 Generate Parentheses

問題描述 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For exampl

原创 Merge k Sorted Lists

問題描述 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思考:k路歸併,用什麼?排序

原创 Next Permutation

問題描述 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of number

原创 Swap Nodes in Pairs

問題描述 Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should

原创 Shortest Palindrome

問題描述 Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and retu

原创 Trapping Rain Water

問題描述 Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much wat