Even though people mentioned this years ago, O(n^2) solution got accepted. This makes me want to go to leetcode instead


#1

Comment body goes here.


#2

This takes o(n):