← Amazon questions

Replace elements with greatest on right and minimize distinct characters

Filed under Amazon

Part 1: Replace every element in an array with the greatest element to its right. Part 2: Given an array of characters and integer K, minimize replacements to ensure only K distinct characters remain.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.