Microsoft Interview Experience (3 years Experienced)
Team Name: Azure DevOps
Given an array of probability distribution, generate a function to return a char with given probability.
str=[‘a’, ’b’, ’c’]
probabilityDistribution =[50, 25, 25]
4 outputs when called 4 times =a, a, b, c. Create a function
There are coins stored in tree nodes. Each node is supposed to have exactly 1 coin. Total no of coins in a tree is = no of nodes. But the coins are not equally distributed and have to moved to proper nodes (which have >1 or <1 coins). Find the number of moves required.
1 website could link to many other websites. Design a crawler service that could return all websites that are recursively reachable from this website. Design a distributed system where all results cannot be stored in 1 node. [Ans= Decouple storage and compute]
Maximum sum subarray: https://www.geeksforgeeks.org/maximum-subarray-sum-using-divide-and-conquer-algorithm/
Factory pattern question
How do you consume info from an API which produces data faster than you can consume ?
OOPS- Design a Lift.( X cars, each car can have max P passengers, not destination controlled)