Pregunta de entrevista de Walmart

LeetCode hard problem. Some Java and database what is questions.