Here each resource have a single instance, we can check whether a given system is safe or not is by checking whether there exists a cycle or not, To detect cycle in the graph, the most efficient algorithm is the DFS, So, Time complexity should be O(m+n), assumed number of edges approximately equals to the number of vertices.
But the answer given is O(m*n^2).
Can anyone explain how O(m*n^2)?