Company: Ziprecruiter
Difficulty: medium
Fish Catch Problem Imagine that you are going fishing at the local pond. The size of the bait must be strictly smaller than the size of the fish for it to catch. Once the fish is caught, it is removed from the pond and cannot be caught again. However, each bait can be used up to 3 times before depletion. Given two arrays fish and baits , where fish[i] corresponds to the size of the i th fish in the pond, and baits[j] corresponds to the size of the j th bait, your task is to return the maximum number of fish you can catch from the pond with the given baits. To compute the answer, you need to use each bait to its possible extent, going from the largest bait to the smallest bait. Use each bait to catch the largest fish remaining in the pond and move to the next bait if the current bait was used three times or if it is not strictly smaller than the largest remaining fish. When you run out of baits, return the number of caught fish. Note: You are not expected to provide the most optimal sol