• + 1 comment

    I have an even more space-efficient solution in O(1) auxiliary space (better than O(d) space) and O(n) time. https://www.hackerrank.com/challenges/beautiful-triplets/forum/comments/423984