#3388

Count Beautiful Splits in an Array

expert · 1210 · lc medium +32 · 18.6% accepted · 105 likes · top 1%

Description

You are given an array nums.

A partition of nums into three non-empty consecutive subarrays nums1, nums2, nums3 (in order) is called beautiful if:

- nums1 is a prefix of nums2, OR nums2 is a prefix of nums3.

Return the number of ways to make such a partition.

Code

1
2
3