原创 [CrackCode] 4.4 Creates a linked list of all the nodes at each depth of a given tree

Given a binary search tree, design an algorithm which creates a linked list of all thenodes at each depth (eg, if

原创 [leet code] Valid Sudoku

Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled

原创 [leet code] Longest Consecutive Sequence

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

原创 [leet code] Subsets II

Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Elements in a su

原创 [CrackCode] 5.1 Set all bits between i and j in N equal to M

You are given two 32-bit numbers, N and M, and two bit positions, i and j Write amethod to set all bits between i

原创 [leet code] Count and Say

The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read o

原创 [leet code] Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equ

原创 [leet code] Combination Sum

Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate n

原创 [leet code] Binary Tree Zigzag Level Order Traversal

Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then righ

原创 [leet code] Construct Binary Tree from Inorder and Postorder Traversal

Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do

原创 [leet code] Jump Game

Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element

原创 [leet code] Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row

原创 [leet code] Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5

原创 [leet code] Insertion Sort List

Sort a linked list using insertion sort. ===================== Analysis: Idea is to implement the insertion sort from a

原创 [CrackCode] 5.2 Print the binary representation

Given a (decimal - e g 3.72) number that is passed in as a string, print the binary rep-resentation If the number