CoolMind


If you cannot measure it, you cannot improve it.

Intersecting node of two lists

Problem Solution Problem This problem was asked by Google. Given two singly linked lists that intersect at some point, find the intersecti...

Minimum cost to color houses

Problem Solution Problem This problem was asked by Facebook. A builder is looking to build a row of N houses that can be of K different co...

Sliding maximum of range k subarray

Problem Solution Complexity analysis Problem This problem was asked by Google. Given an array of integers and a number k...

Longest file path size

Problem Solution Problem This problem was asked by Google. Suppose we represent our file system by a string in the following manner: The ...

Fixed size queue

Problem Solution Problem This problem was asked by Twitter. You run an e-commerce website and want to record the last N order ids in a log...

Pick a number randomly from an unlimited stream

Problem Solution Comments Problem This problem was asked by Facebook. Given a stream of elements too large to store in memory, pick a ra...

Estimate PI

Problem Solution Problem This problem was asked by Google. The area of a circle is defined as $\pi r^{2}$ . Estimate $\pi$ to 3 decimal pl...

At most distinct K

Problem Solution Problem This problem was asked by Amazon. Given an integer k and a string s, find the length of the longest substring tha...