Reported interview periodNot available
Batch inference requests under a capacity budget
A serving path receives requests in order. Pack them greedily into batches that respect both a total-size capacity and a maximum request count, then report the batch count and batch sizes.
Practice focus- The first line has two integers: the batch capacity C and the maximum request count per batch B . The second line is the request count n , and the third line has n request sizes. - Walk the requests in input order. Add the next request to the current batch when the total size stays within C and the count stays within B ; otherwise close the batch and start a new one. - Every request must be placed exactly once, in order; a request equal to C forms its own batch. - Return batches=<count ;sizes=<s1 ,<s2 ,... with the batch totals in order.…