原创 Longest Consecutive Sequence (Java)

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

原创 Find Minimum in Rotated Sorted Array II (Java)

Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time c

原创 Edit Distance (Java)

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation

原创 Permutations II (Java)

Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,

原创 Repeated DNA Sequences (Java)

All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studyin

原创 Candy (Java)

There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these child

原创 Longest Valid Parentheses (Java)

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parenth

原创 Insert Interval (Java)

Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assu

原创 Sudoku Solver (Java)

Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'.

原创 Merge k Sorted Lists (Java)

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. merge two sorted li

原创 Maximal Rectangle (Java)

Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. 設

原创 Palindrome Partitioning II (Java)

Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts nee

原创 Binary Tree Maximum Path Sum (Java)

Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example: Giv

原创 Median of Two Sorted Arrays (Java)

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall

原创 First Missing Positive (Java)

Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3