You are given an integer n and an integer array limit of length m.
You want to divide a strip of length n into two segments and paint each segment with a distinct color from index m
A configuration is determined by choosing an ordered pair of distinct color indices (i, j) where i j, and an integer length x such that:
The first segment has length x, painted with color i, with limit[i].
The second segment has length n j, with n limit[j].
Return the total number of valid ways to paint the strip.
Constraints:
n
m limit.length
limit[i]
You are given an integer n and an integer array limit of length m.
You want to divide a strip of length n into two segments and paint each segment with a distinct color from index m
A configuration is determined by choosing an ordered pair of distinct color indices (i, j) where i j, and an integer length x such that:
The first segment has length x, painted with color i, with limit[i].
The second segment has length n j, with n limit[j].
Return the total number of valid ways to paint the strip.
Constraints:
n
m limit.length
limit[i]