Question: You are given a task to build a data structure behind a set of functions to add tasks each with a weight associated with it and a function to pick a task. Write a class to manage these set of tasks with the following features:
For example, let’s say we have two tasks Task-A with weight 6 and Task-B with weight 4. If I call the pickTask() function 100 times I should get on average Task-A served 60 times and Task-B served 40 times.