Https Leetcode Com Problems Nested If Statements Java