- GeekNetScience, Technology & Engineering
- GhostStresserScience, Technology & Engineering
- IdeaplatzScience, Technology & Engineering

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.

Input:

{1, 2, 13, 5}

{11, 10, 9, 6}...

{3, 4, 8, 7}

{12, 14, 15, 16}

Output:

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

#Bloomberg #programming breadth first search

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

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

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

Output: [1, 1, 6, 6, 7]

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.

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

Example:

Input: [1, 1, 2]...

Output: 3. The permutations are 112, 121, 211.

Input: [1, 2, 1, 3]

Output: 12.

Design an online multiplayer blackjack game. Needs to support:

- multiple decks of cards

- random unpredictable shuffling

- multiple human players

- card drawing...

- hand splitting

- betting

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

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

2

3

5

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

#Dropbox Design & Architecture #interview

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.

ex:

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

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

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.

e.g

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

Design a system to support the hashtag feature from Twitter.

#Hashtag10 #Twitter system design #interview

https://twitter.com/Twitter/status/900327061264486400

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.

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?

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.

Example:

a = "123"

b = "45"...

add(a, b) = "168"

#Google technical phone screen #interview