原创 Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins. For example, the fol

原创 Largest Number @leetCode

Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3,

原创 Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical line

原创 Implement strStr()

Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part o

原创 Valid Sudoku

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

原创 Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each

原创 4Sum

Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all

原创 Letter Combinations of a Phone Number

Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit

原创 String to Integer (atoi)

Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a

原创 Combinations

Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 an

原创 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

原创 Sudoku Solver

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

原创 Maximum Gap

Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to solve

原创 Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2

原创 Contains Duplicate III

Given an array of integers, find out whether there are two distinct indices i and j in the array such that the dif