Problems with tag O(n * max(cnt))