A kanban board has k swimlanes, and a manager wants to spread tasks with effort points efforts across them so that every lane has exactly the same total effort. Every task goes into exactly one lane.
Write canSplitIntoLanes(efforts, k) that returns true if such a split exists, and false otherwise.
Input: efforts = [5,1,4,2,3,3], k = 3 Output: true
Lanes of 5 + 1, 4 + 2, and 3 + 3, each adding up to 6.
Input: efforts = [1,2,3,4], k = 3 Output: false
The total is 10, which can't be split into 3 equal whole parts.
1 <= k <= efforts.length <= 161 <= efforts[i] <= 10000Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #559 Split Tasks Into K Equal Lanes. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.