How to solve this problem using graph

https://www.hackerearth.com/practice/algorithms/graphs/graph-representation/practice-problems/algorithm/uniformity-794d7bdc/

I dont know but somehow i did it using binary search it passed all the test cases. But no idea how to solve tuis using graphs

1 Like

even author’s editorial is not using graphs in this