- DomoviScience, Technology & Engineering
- MH AcousticsScience, Technology & Engineering
- Hawaii Wedding - Carr PhotographyPhotographer

Given a N*M matrix A[][] representing a 3D figure. The height of the building at (i, j) is A[i][j] . Find the surface area of the figure.

Input : N = 1, M = 1 A[][] = { {1} }

Output : 6

Explanation :

The total surface area is 6 i.e 6 side of

the figure and each are of height 1.

Input : N = 3, M = 3

A[][] = { {1, 3, 4},

{2, 2, 3},

{1, 2, 4} }

Output : 60

System Design: About Proxies and Load Balancing

https://blog.envoyproxy.io/introduction-to-modern-network-l…

How many distinct Max Heaps can be made from n distinct integers?

##### CodingPill is celebrating the new year.

Given a binary array a[] and a number k, we need to find length of he longest subsegment of ‘1’s possible by changing at most k ‘0’s.

Input : a[] = {1, 0, 0, 1, 1, 0, 1}, k = 1

Output : 4

Input : a[] = {1, 0, 0, 1, 0, 1, 0, 1, 0, 1}, k = 2

Output : 5

Given pointer to the head node of a linked list, the task is to reverse the linked list. We need to reverse the list by changing links between nodes.

Input : Head of following linked list

1->2->3->4->NULL

Output : Linked list should be changed to...

4->3->2->1->NULL

Input : Head of following linked list

1->2->3->4->5->NULL

Output : Linked list should be changed to

5->4->3->2->1->NULL

Input : NULL

Output : NULL

Input : 1->NULL

Output : 1->NULL

You are given a 3×3 grid of light bulbs. Some lights are “on”, and some are “off”. Next to each light there is a button. Pressing that button results in toggling the state of both the current light and its four adjacent lights (left, right, up down).

For a given configuration find the minimum number of button presses such that all the lights are “off”.

Write a hit counter for hits received in the past 5 minutes.

The HitCounter has two methods:

void hit() // records a hit.

long getHits() // Returns the number of hits in the last 5 minutes.

Given a list of words and an array of letters, find the shortest word containing all those letters.

Input:

words = { cracking, the, coding, interview }

letters = { i, n }

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