Implement a class to represent an undirected graph using a hash where keys are nodes and values are arrays of connected nodes.
HardProblem Statement
Implement a class to represent an undirected graph using a hash where keys are nodes and values are arrays of connected nodes.
Sample Input
g = Graph.new; g.add_edge('A', 'B')Sample Output
{"A"=>["B", "C"], "B"=>["A"], "C"=>["A"]}
true
false
Limits
Time: 2s · Memory: 256 MB