Skip to content

Practice Check if There is a Valid Partition For The Array

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

Medium#2369
LeetCode Problem

Check if There is a Valid Partition For The Array

Problem Statement

Partition all of nums into contiguous blocks. Each block must be either two equal values, three equal values, or three increasing consecutive integers with step 1. Return whether at least one valid partition exists.

Source: Check if There is a Valid Partition For The Array on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [4,4,4,5,6]
Output
true

# Example 2

Input
nums = [1,1,1,2]
Output
false

Constraints

2 <= nums.length <= 10^5
1 <= nums[i] <= 10^6

Related LeetCode Problems

Practice more problems similar to Check if There is a Valid Partition For The Array.

Review your practice with PhantomCodeAI

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