This is a verified interview question from De-shaw. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Minimum Number of Forwarding Operations - De Shaw OA NIT Bhopal" covers key patterns like Other.
"### Problem Statement You are given an array $req$ containing floating-point numbers, where each element represents the weight of a specific request. You need to forward all the requests. You can forward multiple requests together in a single operation, provided that the sum of their weights does not exceed $3.00$. Find the minimum number of forwarding operations (or batches) required to successfully send all requests. ### Input Format - The first line contains an integer $n$, representing the number of requests. - The second line contains $n$ space-separated floating-point numbers representing the array $req$. ### Output Format - Print a single integer representing the minimum number of forwarding operations required. ### Example #### Input: ``` 5 1.1 1.5 2.5 3.00 1.2 ``` #### Output: ``` 4 ``` #### Explanation: You can group the requests as follows to minimize the count: 1. [3.00] (Sum: 3.00 ≤ 3.00) 2. [2.5] (Sum: 2.5 ≤ 3.00) 3. [1.1, 1.5] (Sum: 2.6 ≤ 3.00) 4. [1.2] (Sum: 1.2 ≤ 3.00) Total number of forwarding operations = 4."
Join thousands of developers practicing for De-shaw.