DE SHAW Online Round Question
Given an array of positive integers, each of which represent the number of litres of water in that particular bucket, we have to make the litres of water in every bucket equal.
We are allowed to do two types of operations any number of times:
1) We can altogether remove a bucket from the sequence
2) We can remove some water from a bucket
We have to tell what is the minimum number of litres removed to make all buckets have the same amount of water.
1 2 3
We remove bucket 1 and remove 1 liter from Bucket 3, so total water removed is 2 liter (the amount of water in the bucket removed gets added to the total water removed).
Any idea on what would be a possible solution to this?
Open Chat in New Window