Time complexity: O(n^3)
Space complexity: O(1)
Runtime 23 ms Beats 35.09% of users with Java Memory 43.56 MB Beats 88.18% of users with Java