This is a verified interview question from Algo-university. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Minimum Chocolates" covers key patterns like Arrays.
"### Problem You are given integers N — number of boxes of chocolates (1 ≤ N ≤ 10^5) and K — required chocolates (K ≥ 0). You are also given N integers — number of chocolates in each box, A[1], A[2], ..., A[N] (1 ≤ A[i] ≤ 10^13) ### Goal Find the minimum number of boxes needed to get at least K chocolates. If it's impossible to get at least K chocolates from any group, return -1. ### Input - N: number of boxes - K: required chocolates - A: array of integers representing the number of chocolates in each box ### Output The minimum number of boxes needed to get at least K chocolates. If it's impossible to get at least K chocolates from any group, return -1."
Join thousands of developers practicing for Algo-university.