SKIING - Editorial

can anyone plzz tell me in order to solve this question i have to learn KOSARAJU’S ALGO or not , i know nothing about SCC and very weak graph thory(i.e BFS and DFS)

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

I am sorry that I can’t comment at the top, but I want to add on to @chef_keshav and @meooow comments that this soln in JAVA works fine with dfs.