Ad
  • Custom User Avatar

    This can be solved in O(log n). Is this needed or is a simple O(n * log n) brute force sufficient? I mean, information to figure out which of them is desired is missing from the question and the latter is barely interesting

  • Custom User Avatar

    what the heck kind of restriction is that?! How is one solution "better" than the other if it has the same asymptotic complexity, same code length and same real-world performance. That's just arbitrary.