Ad
  • Custom User Avatar

    Your first solution is O(n2) the other one uses sort that's O(n * log(n)), sometimes solutions revalidation doesn't work, if you have seen other solutions you could see better performing solutions work.