Adjacency Matrix for Undirected Graph - WA

Problem : https://www.hackerearth.com/practice/algorithms/graphs/graph-representation/tutorial/

My code : https://pastebin.com/NY7EnigX

It shows that my code isn’t printing anything. Can anyone please help?

The problem is asking you to first take N, and then take M as input. You are doing it the other way around.
Maybe that’s where the problem lies.

1 Like