PayPay interview question

CodeSignal tasks 3 easy 1 medium