Amplitude Hackathon Winter '25 Problem 5 - Ask Amplitude Hallucinations

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type

What is Spenser's favorite integer?

Ask Amplitude claims that Spenser's favorite integer is integerGuess. It turns out that this is almost correct - Ask Amplitude has hallucinated some additional digits.

We know that Spenser's favorite integer has exactly length digits, and Spenser's favorite integer is the largest integer that can be derived after deleting enough digits from integerGuess to be exactly the right length.

Constraints

1 \le length \le |integerGuess| \le 10^6

Subtask 1 [1 point]

|integerGuess| \le 10

Subtask 2 [1 point]

|integerGuess| \le 10^3

Subtask 3 [1 point]

No additional constraints.

Input Specification

The first line contains a single integer, length.

The next line contains integerGuess, the integer that Ask Amplitude generated.

Output Specification

Output a single integer, Spenser's favorite integer.

Sample Input 1

3
8567

Sample Output 1

867

Sample Input 2

3
2671

Sample Output 2

671

Comments

There are no comments at the moment.