> For the complete documentation index, see [llms.txt](https://coding-9.gitbook.io/untitled/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coding-9.gitbook.io/untitled/insights-and-new-learnings/comparator-sort.md).

# Comparator Sort

## Learnings

## Intuition

```
comp(a,b) == true 
Means a is before b is correct ordering


Now, 
if comp(a,b) == true, then comp(b,a) == false and comp(a,a) == false;

Hence 

comp(a,b){
    return a<=b 
    // Gives error, because it is confused between a->b or b->a, both returns true
}
```

### Links

<https://leetcode.com/problems/longest-string-chain/description/?envType=daily-question&envId=2023-09-23>
