Trimble Interview Question

They asked me to solve a complex problem in Java to solve