← All problemsSign in

3336. Find the Number of Subsequences With Equal GCD

LeetCodeArrayMathDynamic ProgrammingNumber TheoryOpen on judge ↗

You are given an integer array nums. Your task is to find the number of pairs of non-empty subsequences (seq1, seq2) of nums that satisfy the following conditions: - The subsequences seq1 and seq2 are disjoint, meaning no index of nums is common between them. - The GCD of the elements of seq1 is equal to the GCD of the elements of seq2. Return the total number of such pairs. Since the answer

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