Find the vertex diagonally opposite to the vertex M from an N | Function to return the required vertex ; Case 1 : ; Case 2 : ; Driver Code
def getPosition ( N , M ) : NEW_LINE INDENT if ( M > ( N // 2 ) ) : NEW_LINE INDENT return ( M - ( N // 2 ) ) NEW_LINE DEDENT return ( M + ( N // 2 ) ) NEW_LINE DEDENT N = 8 NEW_LINE M = 5 NEW_LINE print ( getPosition ( N , M ) ) NEW_LINE