Skip to content

Latest commit

 

History

History
109 lines (76 loc) · 2.08 KB

algo-qs.md

File metadata and controls

109 lines (76 loc) · 2.08 KB

Questions on Algorithms

Q: Merge two arrays and sort them
Q: How do you compute an inverse of a matrix with some tricks?
Q:Design a Hit-counter

“Design hit counter” problem has recently been asked by many companies including Dropbox and the question is harder than it seems to be. It includes a couple of topics like basic data structures design, various optimization, concurrency and distributed counter.

It should support the following two operations: hit and getHits.


HitCounter counter = new HitCounter();

// hit at timestamp 1.
counter.hit(1);

// hit at timestamp 2.
counter.hit(2);

// hit at timestamp 3.
counter.hit(3);

// get hits at timestamp 4, should return 3.
counter.getHits(4);

// hit at timestamp 300.
counter.hit(300);

// get hits at timestamp 300, should return 4.
counter.getHits(300);

// get hits at timestamp 301, should return 3.
counter.getHits(301);
Q: Program an algorithm to find the best approximate solution to the travelling salesman problem in a given time
Q: Program an algorithm to find the best approximate solution to knapsack problem in a given time
Q: Write an algorithm that can calculate the square root of a number
Q: Given a list of numbers can you return the outliers
Q: Write a bubble sort
Q: Write a merge sort
Q: Write a program that can looks an integer array that equal a certain value
Q: Given two sorted arrays, merge them into one array
Q: Boggle Question: how do you find all the permutations of boggle letters? 
Q: 2nd part implement a dictionary that lets you look up the words quickly - trie. Pass the graph and trie node in recursive functions.
Q: Given an infinite stream of data, how would you pull a random sample?
Q: Write a program to draw a circle?
- eight way symmetry
- sqrt y for x + r
- no sqrt -> Bressanhams error: 
Q: pull a random sample with a weighted probability
Q: conways life: big grid of cells that are on or off
Can solution order number of living cells
parallelize it