Tap here to switch tabs
Problem
Submissions

Problem: Count Values With Equally Spaced Occurrences II

Try to solve the Count Values With Equally Spaced Occurrences II problem.

Statement

You are given an integer array nums.

A distinct value xx is called special if it satisfies both of the following conditions:

  • It appears at least 33 times in nums.

  • The difference between every pair of consecutive indices where xx appears is equal (the occurrence indices form an arithmetic sequence).

Return the number of distinct special values in nums.

Constraints:

  • 3≤3 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Values With Equally Spaced Occurrences II

Try to solve the Count Values With Equally Spaced Occurrences II problem.

Statement

You are given an integer array nums.

A distinct value xx is called special if it satisfies both of the following conditions:

  • It appears at least 33 times in nums.

  • The difference between every pair of consecutive indices where xx appears is equal (the occurrence indices form an arithmetic sequence).

Return the number of distinct special values in nums.

Constraints:

  • 3≤3 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9