Jump to
Press alt + / to open this menu
CommunitySee All
Highlights info row image
40 people like this
Highlights info row image
57 people follow this
People Also Like

Given a 2d matrix of size m*n, find the longest consecutive path in it. You could go in the four directions: right, left, up and down. No other directions allowed.

{1, 2, 13, 5}
{11, 10, 9, 6}...
{3, 4, 8, 7}
{12, 14, 15, 16}

5, 6, 7, 8, 9, 10, 11

#Bloomberg #programming breadth first search

See More
No automatic alt text available.

Given two very large sparse matrices, design a storage schema and implement a function to do matrix multiplication?

#sparse #matrix #multiplication #coding

Image may contain: text

Given a stream of integers, find the median value of the stream:

Input: [1, 7, 6, 9, 8]
Output: [1, 1, 6, 6, 7]

... See More
No automatic alt text available.

On a 8 X 8 chessboard, you are given a starting position. Find out the number of moves required for the knight to move to a ending position. Return -1 if that position can't be reached.

#SiliconValley #coding #interview

Image may contain: shoes

Count the number of distinct permutations of an array of symbols.


Input: [1, 1, 2]...
Output: 3. The permutations are 112, 121, 211.

Input: [1, 2, 1, 3]
Output: 12.

See More
No automatic alt text available.

Design an online multiplayer blackjack game. Needs to support:
- multiple decks of cards
- random unpredictable shuffling
- multiple human players
- card drawing...
- hand splitting
- betting

See More
No automatic alt text available.

Implement a data structure that supports all the stack operations push(), pop(), top(), isEmpty() as well as getMin() in O(1).

#Amazon #software #engineering #interview

No automatic alt text available.

How would you build an efficient prime number generator?

Let the generator be an object G with the method nextPrime(). When we call it G.getNextPrime() the first time it returns 2. Every time we call it again it returns the next prime number.

So if we do:...
G = PrimeGenerator()
print G.nextPrime()
print G.nextPrime()
print G.nextPrime()

We'll get

See More
No automatic alt text available.

Design a revision control system like Git (https://en.wikipedia.org/wiki/Git)

#Dropbox Design & Architecture #interview

Image may contain: text

Nice rolling hash problem from #Booking.com interviews

Find the most popular sequence of 3 consecutive visited pages

Given log = [...
{ 'user': '1', 'page': 'A'},
{ 'user': '2 ', 'page': 'B'},
{ 'user': '1', 'page': 'B'},
{ 'user': '1', 'page': 'D'},
{ 'user': '2', 'page': 'A'},
{ 'user': '3', 'page': 'B'},
{ 'user': '3', 'page': 'D'},
{ 'user': '1', 'page': 'C'},
{ 'user': '3', 'page': 'C'},
{ 'user': '1', 'page': 'C'},
{ 'user': '2', 'page': 'C'},
{ 'user': '3', 'page': 'B'},
{ 'user': '1', 'page': 'A'},
{ 'user': '3', 'page': 'C'},

We need to find the sequence of pages of length 3, that is the most popular.
user 1 visits: A, B, D, C, A
user 2 visits: B, A, C
user 3 visits: B, D, C, B, C

Possible consecutive sequences: ABD, BDC, DCA, BAC, DCB, CBC

The most popular is BDC, since user 1 and user 3 visit that sequence

See More

Design a service to generate 64bit IDs that satisfies all the following requirements:

1. All IDs are unique
2. IDs are roughly in order (k-sorted, where k is on the order of a few seconds)
3. Multi-dc...
4. Low latency
5. Highly available in the case of machine, network and datacenter failures

#Twitter Distributed ID Generator / System Design Interview

See More

Given an array of length N, where array[i] is the count of ways we can produce the amount i,
find out the set of denominations.



input: [1, 0, 1, 0, 1, 1, 1, 2, 1, 2, 2] -> output: [2, 5, 7]

#Sieve of #Eratosthenes

See More

Design a system to support the hashtag feature from Twitter.

#Hashtag10 #Twitter system design #interview

“10 years ago today the hashtag was born on Twitter. 🎂 #Hashtag10 https://t.co/upTBCkzDNP

Split an array of integers into two subsets with minimum difference.

Given an array containing N numbers, we need to split the array into two subsets, such that the difference between the sum of the two subsets is minimised.

#programming #interview #practice http://www.codingpill.com

Our interviewers have years of experience working for well-reputed Bay Area companies such as Google, Facebook and Dropbox. The entire process will follow the interview practices run by Silicon Valley.

Find the middle element in a linked list.

You may only use O(1) additional memory.
What if you are allowed to use at most 3n/2 assignments?

... See More

Given a 2D binary matrix (filled with 0s and 1s), find the largest rectangle containing all ones and return its area.

O(lines * columns)
#Microsoft dynamic #programming and #stacks


You are given two strings representing two large positive integers (up to 1000 digits each). Write a function that computes the sum of the two numbers.

a = "123"
b = "45"...
add(a, b) = "168"

#Google technical phone screen #interview

See More