Given a collection of intervals, merge all overlapping intervals.

For example:

12 Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].

- Mar 30, 2017...more
## Longest Substring with At Least K Repeating Characters

Mar 29, 2017...moreFind the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than k times.

Example 1:

1234Input:s = "aaabb", k = 3Output:3- The longest substring is “aaa”, as ‘a’ is repeated 3 times.

Example 2:

1234Input:s = "ababbc", k = 2Output:5- The longest substring is “ababb”, as ‘a’ is repeated 2 times and ‘b’ is repeated 3 times.

## Bulb Switcher

Mar 28, 2017...moreThere are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or turning off if it’s on). For the ith round, you toggle every i bulb. For the nth round, you only toggle the last bulb. Find how many bulbs are on after n rounds.

Example:

12345678Given n = 3.At first, the three bulbs are [off, off, off].After first round, the three bulbs are [on, on, on].After second round, the three bulbs are [on, off, on].After third round, the three bulbs are [on, off, off].So you should return 1, because there is only one bulb is on.## Contains Duplicate III

Mar 27, 2017...moreGiven an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t and the absolute difference between i and j is at most k.

## Evaluate Reverse Polish Notation

Mar 26, 2017...moreEvaluate the value of an arithmetic expression in Reverse Polish Notation.

Valid operators are +, -, *, /. Each operand may be an integer or another expression.

Some examples:

12["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6