Practice Count Beautiful Splits in an Array
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Split nums into three nonempty contiguous parts that cover the array in order. A split is beautiful if the first part is a prefix of the second, or the second part is a prefix of the third. Count the beautiful splits, counting a split only once even if both conditions hold.
Source: Count Beautiful Splits in an Array on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [1,1,2,1]
Output
2
# Example 2
Input
nums = [1,2,3,4]
Output
0
Constraints
1 <= nums.length <= 5000
0 <= nums[i] <= 50
Related LeetCode Problems
Practice more problems similar to Count Beautiful Splits in an Array.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.