LegalMatch interview question

Just basic java and logic problem