#3468

Find the Number of Copy Arrays

specialist · 935 · lc medium +32 · 46.8% accepted · 108 likes · top 31%

Description

Given array original of length n and bounds bounds[i] = [ui, vi], count arrays copy of length n satisfying:

- Adjacent differences match: copy[i] - copy[i-1] == original[i] - original[i-1] for all valid i.

- Each element stays in range: ui <= copy[i] <= vi.

Return the total count of valid copy arrays.

Code

1
2
3