I was trying to submit this -> [Remove Max Number of Edges to Keep Graph Fully Traversable](https://leetcode.com/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable/) question. <br>↵
but I got TLE because of sort using rbegin ↵
↵
```↵
sort( edges.rbegin(), edges.rend())↵
```↵
↵
but after change with comparator funtction code got accepted. ↵
↵
```↵
sort(edges.begin(), edges.end(), [&](vector <int> &a, vector <int> &b){↵
return a[0] > b[0];↵
});↵
```↵
↵
[Submission Using rbegin](https://p.ip.fi/wuD8)↵
↵
[Submission Using comparator](https://p.ip.fi/gSsl)↵
↵
↵
I tried to run this in local and got similar performance but when I used some different build command I got 2x time difference. ↵
↵
Build command: ↵
↵
↵
```g++ a.cpp```↵
↵
↵
↵
```g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -DLOCAL a.cpp```↵
↵
↵
Following code I used for bench-marking. ↵
↵
↵
[Bench-marking code](https://p.ip.fi/Wmnz)↵
↵
Can anyone explain why this time difference happening? <br>↵
Will this happened in code-forces also? ↵
↵
but I got TLE because of sort using rbegin ↵
↵
```↵
sort( edges.rbegin(), edges.rend())↵
```↵
↵
but after change with comparator funtction code got accepted. ↵
↵
```↵
sort(edges.begin(), edges.end(), [&](vector <int> &a, vector <int> &b){↵
return a[0] > b[0];↵
});↵
```↵
↵
[Submission Using rbegin](https://p.ip.fi/wuD8)↵
↵
[Submission Using comparator](https://p.ip.fi/gSsl)↵
↵
↵
I tried to run this in local and got similar performance but when I used some different build command I got 2x time difference. ↵
↵
Build command: ↵
↵
↵
```g++ a.cpp```↵
↵
↵
↵
```g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -DLOCAL a.cpp```↵
↵
↵
Following code I used for bench-marking. ↵
↵
↵
[Bench-marking code](https://p.ip.fi/Wmnz)↵
↵
Can anyone explain why this time difference happening? <br>↵
Will this happen
↵