Modify a Binary String by flipping characters such that any pair of indices consisting of 1 s are neither co | Java program for the above approach ; Function to modify a string such that there doesn 't exist any pair  of indices consisting of 1s, whose  GCD is 1 and are divisible by each other ; Flips characters at indices 4 N , 4 N - 2 , 4 N - 4 . ... upto N terms ; Print the string ; Driver Code ; Initialize the string S ; function call
import java . io . * ; class GFG { public static void findString ( char S [ ] , int N ) { int strLen = 4 * N ; for ( int i = 1 ; i <= N ; i ++ ) { S [ strLen - 1 ] = '1' ; strLen -= 2 ; } System . out . println ( S ) ; } public static void main ( String [ ] args ) { int N = 2 ; char S [ ] = new char [ 4 * N ] ; for ( int i = 0 ; i < 4 * N ; i ++ ) S [ i ] = '0' ; findString ( S , N ) ; } }