• + 1 comment

    Pretty good although this approach is not the quickest. It will be at best O(n * log(n)). With a dictionary approach, it can be done in O(n).