← Questions

Most distinct values after shifting each element by at most k

0
SpaceXAICodingLast asked Jan 2026

You may add any integer between -k and k to each element of an array, choosing independently for each. Return the largest number of distinct values the array can end up with.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding