Here is the closest match to what you are asking for: the well-known “good subarray (multiple of k)” interview problem is the standard Continuous Subarray Sum problem, which uses array, hash table, prefix sum, and math, and explicitly defines a “good subarray” in terms of the sum being a multiple of $$k$$. No other public problem titled exactly “Good Subarray (Multiple of K)” could be found with a complete official statement, examples, and constraints beyond this formulation.[1][2][3][4]
You are given an integer array nums and an integer k.[1] Return true if nums has a good subarray, otherwise return false.[1]
A subarray is called good if:
A subarray is a contiguous non-empty sequence of elements in the array.[4]
Equivalently, you need to determine whether there exists indices $$i < j$$ such that:
Return:
true if at least one such subarray exists.false otherwise.[1]This is typically solved with prefix sums, a hash table keyed by prefix-sum remainders modulo $$k$$, and simple modular arithmetic.[4]
Most commonly (e.g., LeetCode 523: Continuous Subarray Sum), the function signature is:[1]
text bool checkSubarraySum(vector<int>& nums, int k)
or, in a more language-agnostic description:[1]
nums: integer array.k: integer (can be positive, negative, or zero depending on platform; standard version assumes non-zero k).[4][1]true or false indicating whether a good subarray exists.[1]As an interview question (e.g., at Adobe), the problem statement is usually given in this functional style rather than as stdin/stdout format, but when it is adapted to console I/O it is typically:
nums.k.true / false (or a similar indicator) on a single line, representing whether a good subarray exists.This I/O style is not standardized by any official statement but reflects common competitive-programming practice around this exact problem.[1]
Input:[1]
nums = [23, 2, 4, 6, 7], k = 6
One good subarray is [2, 4] whose sum is 6, which is a multiple of 6.[1]
There are others such as [23, 2, 4, 6] with sum 35, which is not a multiple of 6, but at least one valid subarray exists (e.g. [2, 4]).[1]
Output:
true[1]
A common variant example:[4]
Input:
nums = [23, 2, 6, 4, 7], k = 6
The subarray [23, 2, 6, 4, 7] has sum 42, which is a multiple of 6, and has length at least 2.[4]
Output:
true[4]
Input:[4]
nums = [1, 2, 3], k = 5
No contiguous subarray of length at least 2 has sum divisible by 5.[4]
Output:
false[4]
Edge-case style example:[3]
Input:
nums = [23, 2, 4, 7], k = 6
A good subarray (length ≥ 2, sum multiple of 6) exists, so this would be considered a “Good Subarray”.[3]
Output:
true (“Good Subarray”).[3]
Another edge-case style example:[3]
Input:
nums = [5, 0, 0, 0], k = 3
If you require length at least 2 and sum divisible by 3, there is no such subarray in this specific phrasing of that LinkedIn example (the author labels this “Not Good Subarray”).[3]
Output:
false (“Not Good Subarray”).[3]
The canonical online version (LeetCode 523) uses the following typical constraints (precise values can differ slightly across mirrors, but are generally):[4][1]
Important conceptual constraints used in most solutions:[4]
count[0] = 1) to account for subarrays starting from index 0.[4]To date, there is no widely published Adobe-branded problem statement titled exactly “Good Subarray (Multiple of K)” beyond this standard “good subarray whose sum is a multiple of k” formulation; public references (e.g., interview question lists) mention the title but link back to the Continuous Subarray Sum / subarray-sum-divisible-by-k formulation above.[2][1][4]