Pergunta de entrevista da empresa Yugabyte

to Solve the coding question they gave