Skip to content

Practice Count Special Quadruplets

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1995
LeetCode Problem

Count Special Quadruplets

Problem Statement

Return the number of index quadruplets (a, b, c, d) satisfying 0 <= a < b < c < d < nums.length and nums[a] + nums[b] + nums[c] == nums[d]. Different choices of indices count separately even if their values match.

Source: Count Special Quadruplets on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [1,2,3,6]
Output
1

# Example 2

Input
nums = [3,3,6,4,5]
Output
0

# Example 3

Input
nums = [1,1,1,3,5]
Output
4

Constraints

4 <= nums.length <= 50
1 <= nums[i] <= 100

Related LeetCode Problems

Practice more problems similar to Count Special Quadruplets.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.