i'm trying to solve  problem but i can't find any algorithm better than O(n^2) !↵
↵
your help will be greatly appreciated.
↵
your help will be greatly appreciated.