Find the Student that Will Replace the Chalk
There are n students in a class numbered from 0 to n - 1. The teacher will give each student a certain amount of chalk. You are given an integer array chalk and an integer k. The ith student will receive chalk[i] pieces of chalk. They will consume chalk[i] pieces of chalk each time they perform the following operation:
Find the smallest positive integer x such that chalk[i] * x > k. Reduce chalk[i] * x by k pieces of chalk. Given an integer k, return the index of the student that will replace the chalk after performing the operations described above.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)