Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
leetcode Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Thanks Marcos for contributing this image!
leetcode Rotate Image
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Could you do this in-place?
leetcode First Missing Positive
Given an unsorted integer array, find the first missing positive integer.
Your algorithm should run in O(n) time and uses constant space.
- 31 Next Permutation
- 46 Permutations
- 47 Permutations II
- 60 Permutation Sequence
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
1is read off as
11is read off as
21is read off as
"one 2, then
Given an integer n, generate the nth sequence.
Note: The sequence of integers will be represented as a string.
Determine if a Sudoku is valid, according to: Sudoku Puzzles – The Rules.
The Sudoku board could be partially filled, where empty cells are filled with the character
A partially filled sudoku which is valid.
A valid Sudoku board (partially filled) is not necessarily solvable. Only the filled cells need to be validated.
Given a string containing just the characters
')', find the length of the longest valid (well-formed) parentheses substring.
"(()", the longest valid parentheses substring is
"()", which has length = 2.
Another example is
")()())", where the longest valid parentheses substring is
"()()", which has length = 4.
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters.
For example, given:
You should return the indices:
(order does not matter).