A loyalty program awards a badge when a customer has a run of at least two back-to-back orders whose item counts add up to a multiple of k. The item counts are in nums.
Write hasMultipleStreak(nums, k) that returns true if such a run exists. Note that 0 is a multiple of every k.
Input: nums = [5,3,8,1], k = 4 Output: true
5 + 3 = 8, a multiple of 4.
Input: nums = [1,2,4], k = 8 Output: false
The runs of two or more add up to 3, 6, and 7.
1 <= nums.length <= 10^50 <= nums[i] <= 10^91 <= k <= 2^31 - 1Run 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 #49 Multiple of K Streak Exists. 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.