Unlock the explanation by solving this problem.
Get an accepted submission and the full approach, complexity notes and reference code will appear here.
Try the problemWrite your solution, test it against custom input, then submit for a real verdict.
Your submissions, verdicts, drafts and contest score are tied to your account. Registration is free.
Sign in to rate this problem.