For a given source string and a target string, return the index of the first occurrence target string in source string. If target does not exist in source, just return -1.

Rotate String

Given a string and an offset, rotate string by offset from left to right.

Implement Queue by Two Stacks

Implement a queue using only two stacks.

Subsets II

Given a list of numbers that may has duplicate numbers, return all possible subsets. Each element in a subset must be in non-descending order. The ordering between two subsets is free. The solution set must not contain duplicate subsets.


Given a set of distinct integers, return all possible subsets.

Search Range in Binary Search Tree

Given two values k1 and k2 (where k1 < k2) and a root pointer to a binary search tree, find all the keys in the tree in range k1 to k2. Return all the keys in ascending order.

Minimum Window Substring

Given a string source and a string target, find the minimum window in source which will contain all the characters in target.

Partition Array

Given an array nums of integers and an integer k, partition the array (i.e move the elements in “nums”) such that:

Permutations II

Given a list of numbers with duplicate number in it. Find all unique permutations.


Given a list of numbers, return all possible permutations.