Create a graph using given moves in arr [ ]
adj = [ [ ] for i in range ( n ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT if ( i != ( i + arr [ i ] + n ) % n ) : NEW_LINE INDENT adj [ i ] . append ( ( i + arr [ i ] + n ) % n ) NEW_LINE DEDENT DEDENT