- Coding . How many ways to get sum = X with n dice having m faces : https://www.geeksforgeeks.org/dice-throw-dp-30/
- Concurrency : Implement Producer - Consumer problem where there are producers that produce items with weight based on Rank of producer . Is Producer with Rank 1 produces highest value items while Rank 2 next highest value item. Consumers must consume such that they maximize the value of items they consume. Use synchronization constructs to prevent race and handle concurrency.
My Solution : I used multiple Queues and producers insert into the queue based on hash ID of producer Rank . so Rank1 producer inserts into Queue 1 , Rank 2 Producer into Queue 2 and so on . Consumers always consume from Queue 1 first and if it empty they move to Queue 2 . Each queue has mutex and condition variables Empty and Full for blocking Producer / Consumer once the queue to insert or remove from is decided. One global mutex consumer uses to poll all the queues to identify first non-empty queue . Then release global mutex before accessing that Queue.
- Lots of LP queuestion : I guess they were not happy with my answers on those.