Ambiguous output using sort() function with user defined comparator in C++

Правка en1, от Nathan_McKane, 2020-10-15 00:04:00

I was trying a question on searching/sorting (link) and i defined my own comparator for in-built sort(). It produced ambiguous output for the input (Error Code Link). However, when i changed the "<=" to "<" in my comparator, the code (Accepted Code Link) worked properly and was accepted. I dont know how this happened and what was the significance of changing the comparison condition.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Nathan_McKane 2020-10-15 00:04:57 8 Tiny change: 'sorting ([link](http' -> 'sorting ([Problem link](http'
en1 Английский Nathan_McKane 2020-10-15 00:04:00 628 Initial revision (published)