Skip to content

Practice Count Increasing Quadruplets

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

Hard#2552
LeetCode Problem

Count Increasing Quadruplets

Problem Statement

Count quadruples of indices i < j < k < l in nums satisfying nums[i] < nums[k] < nums[j] < nums[l]. The input is a permutation of integers 1 through n.

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

Examples

# Example 1

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

# Example 2

Input
nums = [1,2,3,4]
Output
0

Constraints

4 <= nums.length <= 4000
1 <= nums[i] <= nums.length
All the integers of nums are unique. nums is a permutation.

Related LeetCode Problems

Practice more problems similar to Count Increasing Quadruplets.

Review your practice with PhantomCodeAI

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