Gojek Interview Experience for Internship (On-Campus) 2022
This problem was asked in the OA rounds of Gojek during my On-campus internship in 2022. The problem statement goes as follows:
- There are n processes that need to be assigned to m processors such that the kth processor should have the maximum number of processes (the kth processor is the most efficient one). Also, each processor must be assigned at least one process and the number of processes assigned to the adjacent processors must not exceed 1. You need to find the maximum number of processes that can be assigned to the kth processor following all the given constraints.
This problem is not available anywhere over the internet, so when I solved it, I decided to contribute it here so that others can refer to it and get a glimpse of what kind of questions are asked in the OAs.
At first, this question looked a bit tricky, but after giving it some time, I got the binary search approach to solve the problem.
The C++ code is as follows:
My Personal Notes arrow_drop_up
Please Login to comment...