1819. Number of Different Subsequences GCDs
https://leetcode.com/problems/number-of-different-subsequences-gcds
Description
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.
For example, the GCD of the sequence
[4,6,16]
is2
.
A subsequence of an array is a sequence that can be formed by removing some elements (possibly none) of the array.
For example,
[2,5,10]
is a subsequence of[1,2,1,**2**,4,1,**5**,**10**]
.
Return the number of different GCDs among all non-empty subsequences of nums
.
Example 1:
Example 2:
Constraints:
1 <= nums.length <= 105
1 <= nums[i] <= 2 * 105
ac
Last updated