Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Mirror Inverse Program in java

// Java implementation of the approach
public class GFG {
 
    // Function that returns true if
    // the array is mirror-inverse
    static boolean isMirrorInverse(int arr[])
    {
        for (int i = 0; i < arr.length; i++) {
 
            // If condition fails for any element
            if (arr[arr[i]] != i)
                return false;
        }
 
        // Given array is mirror-inverse
        return true;
    }
 
    // Driver code
    public static void main(String[] args)
    {
        int arr[] = { 1, 2, 3, 0 };
        if (isMirrorInverse(arr))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: change button background drawable in code 
Java :: are classes in java public by default 
Java :: class java 
Java :: menuitemcompat getactionview is deprecated in android 
Java :: java memory cleaner 
Java :: java add backslash into string 
Java :: Reverse Order Output for Java Do-While Loop 
Java :: load local json 
Java :: quitar letras repetidas de una palabra en java 
Java :: what is instance block in java 
Java :: ezra margolin 
Java :: logger output to console twice java 
Java :: java formatted string input 
Java :: serilize filke in java 
Java :: torres de hanoi java 
Java :: EuclideanAlgorithm in Java 
Java :: Java TestNG Data provider Provider with multiple variables 
Java :: material motion android navigation arch 
Java :: venatana emergente con texto java 
Java :: google intent for directions 
Java :: docker how to pass params to spring boot application 
Java :: find the length of jtextfeild in java 
Java :: com.google.firebase.database.DatabaseException: Serializing Arrays is not supported, please use Lists instead 
Java :: cannot apply java lang integer android 
Java :: binary search tree 
Java :: if statement with string java 
Java :: java join list 
Java :: find power of number in method java 
Java :: number of digits program in java 
Java :: Access HashMap Elements 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =