Available question text
Count the number of contiguous subarrays whose greatest common divisor equals k.
Exploit that the running GCD of a subarray only decreases, so for each start index you can extend while maintaining/updating the GCD and stop early when it drops below or is no longer a multiple of k (O(n^2) viable for n ≤ 1000).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2447. Number of Subarrays With GCD Equal to K
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source