Sponsored
Use these hints if you're stuck. Try solving on your own first.
Build the answer digit by digit, adding the largest possible one that would make the number still less than or equal to N.
Solve with full IDE support and test cases