← All problemsSign in

523. Continuous Subarray Sum

LeetCodeArrayHash TableMathPrefix SumOpen on judge ↗

Given an integer array nums and an integer k, return true if nums has a good subarray or false otherwise. A good subarray is a subarray where: - its length is at least two, and - the sum of the elements of the subarray is a multiple of k. Note that: - A subarray is a contiguous part of the array. - An integer x is a multiple of k if there exists an integer n such that x = n * k. 0 is always

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start