Practice Number of Different Subsequences GCDs
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given an array nums that consists of positive integers. The GCD of a sequence of numbers is defined as the greatest integer that divides all the numbers in the sequence evenly. A subsequence of an array is a sequence that can be formed by removing some elements (possibly none) of the array. Return the number of different GCDs among all non-empty subsequences of nums.
Source: Number of Different Subsequences GCDs on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [6,10,3]
5
# Example 2
nums = [5,15,40,5,6]
7
Constraints
Related LeetCode Problems
Practice more problems similar to Number of Different Subsequences GCDs.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.