A rewards program pays out whenever a streak of back-to-back daily point changes in points adds up to a multiple of k (including 0).
Write divisibleStreaks(points, k) that returns how many streaks qualify. Different start or end days count as different streaks.
Input: points = [3,1,2,6,-3], k = 3 Output: 10
For example [3], [1, 2], [6], and [3, 1, 2, 6, -3] all add up to multiples of 3; ten streaks do in total.
Input: points = [5], k = 9 Output: 0
5 isn't a multiple of 9.
0 <= points.length <= 10^5-10^4 <= points[i] <= 10^41 <= k <= 10^4Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #47 Streaks Divisible by K. 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.