Today I appeared in Rebel Foods Backend Challenge on Hackerearth. The first question there was:
There are n books. A group of k people is going to read them all. For each book, you know the time it takes to read it. One person reads a book from beginning to end without switching to another book and only one person can read that particular book at a given time.
Determine the minimum total time such that everyone reads every book.
For examples:
Input
n = 3, k = 3, times = [8, 7, 2]
Output
24
Constraints
1 < k, n <= 10^5
1 <= ti <= 10^9
I couldn't solve the problem. I didn't even manage to understand if it's a DP problem or Greedy or what. Please let me know if anyone of you has seen such questions. I am in desperate need to practice.