Panda Guru LogoPanda
Guru

Sharing Amazon OA coding questions

Round 2

Questions: Given a string s_id, find the lexicographically minimal string of boxes using the following operations:

Note: A string X is lexicographically smaller than a string Y of the same length if and only if in the first position where X and Y differ, the string X has a smaller digit than the corresponding digit in Y.

Example: Given s_id = "26547".

Hence, the string returned is "24677". It can be proved that this is the lexicographically minimal string possible.

Function Description: Complete the function getMinimumString in the editor below. getMinimumString has the following parameter:

Returns:

Constraints:

Input Format For Custom Testing: Sample Input:

04829

Sample Output:

02599

Explanation:

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.