Pergunta de entrevista da empresa Elastic

Leet code medium difficulty question, with a focus on the Java data type