Tap here to switch tabs
Problem
Submissions

Problem: Count Special Subsequences

Count Special Subsequences asks you to count quadruplets of array indices, each separated by at least one position, where the first and third values multiply to equal the second and fourth.

Statement

You are given an array of positive integers nums.

A quadruplet of indices (p, q, r, s) is called a special subsequence if:

  • 0≤p<q<r<s<0 \leq p < q < r < s < nums.length

  • q−p>1q - p > 1

  • r−q>1r - q > 1

  • s−r>1s - r > 1

  • nums[p] ⋅\cdot nums[r] == nums[q] ⋅\cdot nums[s]

Return the total number of special subsequences in nums.

Constraints:

  • 7≤7 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Special Subsequences

Count Special Subsequences asks you to count quadruplets of array indices, each separated by at least one position, where the first and third values multiply to equal the second and fourth.

Statement

You are given an array of positive integers nums.

A quadruplet of indices (p, q, r, s) is called a special subsequence if:

  • 0≤p<q<r<s<0 \leq p < q < r < s < nums.length

  • q−p>1q - p > 1

  • r−q>1r - q > 1

  • s−r>1s - r > 1

  • nums[p] ⋅\cdot nums[r] == nums[q] ⋅\cdot nums[s]

Return the total number of special subsequences in nums.

Constraints:

  • 7≤7 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000