#3694
Distinct Points Reachable After Substring Removal
specialist · 820 · lc medium +31 · 53.8% accepted · 65 likes · top 45%
Description
A direction string s of 'U', 'D', 'L', 'R' describes moves on a 2D grid. Remove exactly one contiguous substring of length k from s, then execute the remaining moves from (0, 0). Return the number of distinct ending coordinates achievable across all valid removal positions.
Code
1
2
3