Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Mirror Inverse Program in python

# Python 3 implementation of the approach
 
# Function that returns true if
# the array is mirror-inverse
def isMirrorInverse(arr, n) :
 
    for i in range(n) :
 
        # If condition fails for any element
        if (arr[arr[i]] != i) :
            return False;
     
    # Given array is mirror-inverse
    return true;
 
# Driver code
if __name__ == "__main__" :
     
    arr = [ 1, 2, 3, 0 ];
     
    n = len(arr) ;
    if (isMirrorInverse(arr,n)) :
        print("Yes");
    else :
        print("No");
 
# This code is contributed by Ryuga
Comment

PREVIOUS NEXT
Code Example
Python :: how to fix value error in model.fit 
Python :: print backward number 
Python :: python async get result 
Python :: Instance Method With Property In Python 
Python :: check true false in python 
Python :: design patterns in python free download 
Python :: Python | Largest, Smallest, Second Largest, Second Smallest in a List 
Python :: how to open cmd as administrator with python 
Python :: Get First From Table Django 
Python :: pytrend 
Python :: rename all files in a folder and subfolder 
Python :: database access layer django 
Python :: Analyzing code samples, comparing more than 2 numbers 
Python :: tweepy to dataframe 
Python :: python iterate through lists itertools 
Python :: display calendar 
Python :: online python pseudo code writer python 
Python :: blue ray size 
Python :: python dash bootstrap buttons with icons 
Python :: is dictreader scoped in python 
Python :: how to make ui dialog pop in front pyqt 
Python :: python inline print variable 
Python :: validate delete inline formset django 
Python :: python - from most_similar to ldictionary 
Python :: varianza en pandas 
Python :: Python Modifying Global Variable From Inside the Function 
Python :: Python match.start(), match.end() 
Python :: Convert Time object to String in python 
Python :: non linear regression 
Python :: NLP text summarization with LSA 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =