Company: Walmart sparkplug
Difficulty: medium
Water Down You are operating a watering tractor on a farm with a row of plants, each having a specific water requirement represented by an array P. You also have a set of buckets, each with a certain amount of water, given in an array W. Your objective is to maximize the number of plants whose water requirements can be fully met. Here's how the watering works: Each bucket's entire water content must be used to water exactly 2 plants, even if one of them doesn't require any water It gets empty irrespective of how much water it holds in the duration of time you take to move over 2 plants You may select any two consecutive plants to water with each bucket, but you must follow the sequence of buckets in order You cannot skip buckets, though you can skip plants if you're not using a bucket at that moment There may be empty buckets with you There also may be plants who do not need any water at all If you reach the last plant, any remaining water from a bucket must be fully poured on that pla