Read the comments and answers here lol…
“dx” and “dy” array together form the possible adjacent vertices in grid while “sort(vals.rbegin(), vals.rend())” sorts the given array in descending order.
Hi, you can also solve it gredily also. See above comments for help.
1 Like
Can u plzz explain again where the concept of SCC is being implemented in this problem or if without SCC how to solve it ?
@coder_ishmeet, SCC is used to find the directed acyclic decomposition of graph as mentioned in editorial. The other approach without SCC is mentioned in author’s solution and comments above. like this one
1 Like
ohkay thnkss alot… i will solve this question with or without SCC both