dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static final int N = 2005 ; static final int mod = 1000000007 ; static int n , q ; static int [ ] par = new int [ N ] , Rank = new int [ N ] ; static HashMap < Integer , Integer > m = new HashMap < > ( ) ; static void initialize ( ) { for ( int i = 0 ; i <= n ; i ++ ) { par [ i ] = i ; Rank [ i ] = 0 ; } } static int find ( int x ) { if ( par [ x ] != x ) par [ x ] = find ( par [ x ] ) ; return par [ x ] ; } static void Union ( int x , int y ) { int xpar = find ( x ) ; int ypar = find ( y ) ; if ( Rank [ xpar ] < Rank [ ypar ] ) par [ xpar ] = ypar ; else if ( Rank [ xpar ] > Rank [ ypar ] ) par [ ypar ] = xpar ; else { par [ ypar ] = xpar ; Rank [ xpar ] ++ ; } } static long power ( long a , long m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( 1L * a * a ) % mod ; else if ( m1 % 2 == 1 ) return ( 1L * a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } static void query ( int l , int r ) { if ( m . containsKey ( l + r ) ) m . put ( l + r , Math . max ( m . get ( l + r ) , r ) ) ; else m . put ( l + r , r ) ; } static long possiblestrings ( ) { initialize ( ) ; for ( Integer i : m . keySet ( ) ) { int x = i - m . get ( i ) ; int y = m . get ( i ) ; while ( x < y ) { Union ( x , y ) ; x ++ ; y -- ; } } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) if ( par [ i ] == i ) ans ++ ; return power ( 26 , ans ) % mod ; } public static void main ( String [ ] args ) { n = 4 ; query ( 1 , 3 ) ; query ( 2 , 4 ) ; System . out . println ( possiblestrings ( ) ) ; } }

Index/key variables: N, i, x, xpar, ypar
Accumulator variables: ans, i, x, y
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static class node { int data ; node left ; node right ; node ( int data ) { this . data = data ; this . left = null ; this . right = null ; } } ; static boolean iterativeSearch ( node root , int x ) { if ( root == null ) return false ; Queue < node > q = new LinkedList ( ) ; q . add ( root ) ; while ( q . size ( ) > 0 ) { node node = q . peek ( ) ; if ( node . data == x ) return true ; q . remove ( ) ; if ( node . left != null ) q . add ( node . left ) ; if ( node . right != null ) q . add ( node . right ) ; } return false ; } public static void main ( String ags [ ] ) { node NewRoot = null ; node root = new node ( 2 ) ; root . left = new node ( 7 ) ; root . right = new node ( 5 ) ; root . left . right = new node ( 6 ) ; root . left . right . left = new node ( 1 ) ; root . left . right . right = new node ( 11 ) ; root . right . right = new node ( 9 ) ; root . right . right . left = new node ( 4 ) ; System . out . print ( ( iterativeSearch ( root , 6 ) ? "Found " : ▁ " Not Found "));  System . out . print ( ( iterativeSearch ( root , 12 ) ? "Found " : ▁ " Not Found "));  } }

Class/struct names: GFG, node
Java program:
class Node { int data ; Node left , right , next ; Node ( int item ) { data = item ; left = right = next = null ; } } void populateNext ( Node node ) { populateNextRecur ( node , next ) ; } void populateNextRecur ( Node p , Node next_ref ) { if ( p != null ) { populateNextRecur ( p . right , next_ref ) ; p . next = next_ref ; next_ref = p ; populateNextRecur ( p . left , next_ref ) ; } }

Class/struct names: Node
Java program:
class gfg { static boolean isValid ( String str , int len ) { for ( int i = 1 ; i < len ; i ++ ) { if ( str . charAt ( i ) == str . charAt ( i - 1 ) ) return false ; } return true ; } public static void main ( String [ ] args ) { String str = "0110" ; int len = str . length ( ) ; if ( isValid ( str , len ) ) System . out . println ( " Valid " ) ; else System . out . println ( " Invalid " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: gfg
Java program:
class GFG { static int check ( String s , int K ) { for ( int ch = 0 ; ch < 26 ; ch ++ ) { char c = ( char ) ( ' a ' + ch ) ; int last = - 1 ; boolean found = true ; for ( int i = 0 ; i < K ; i ++ ) if ( s . charAt ( i ) == c ) last = i ; if ( last == - 1 ) continue ; for ( int i = K ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == c ) last = i ; if ( last <= ( i - K ) ) { found = false ; break ; } } if ( found ) return 1 ; } return 0 ; } static int binarySearch ( String s ) { int low = 1 , high = s . length ( ) ; int ans = 0 ; while ( low <= high ) { int mid = ( high + low ) >> 1 ; if ( check ( s , mid ) == 1 ) { ans = mid ; high = mid - 1 ; } else low = mid + 1 ; } return ans ; } public static void main ( String args [ ] ) { String s = " abcde " ; System . out . println ( binarySearch ( s ) ) ; s = " aaaa " ; System . out . println ( binarySearch ( s ) ) ; } }

Accumulator variables: ch, i
Iterator variables: ch, i
Boolean variables: found
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; public class Gfg { static int vowel_calc ( String s ) { int n = s . length ( ) ; int arr [ ] = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == 0 ) arr [ i ] = n ; else arr [ i ] = ( n - i ) + arr [ i - 1 ] - i ; } int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { char ch = s . charAt ( i ) ; if ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) sum += arr [ i ] ; } return sum ; } public static void main ( String args [ ] ) { String s = " daceh " ; System . out . println ( vowel_calc ( s ) ) ; } }

Index/key variables: i, n
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: Gfg
Java program:
import java . util . * ; class GFG { static class node { int data ; node left , right ; } ; static node newNode ( int data ) { node node = new node ( ) ; node . data = data ; node . left = node . right = null ; return ( node ) ; } static boolean iterativeSearch ( node root , int x ) { if ( root == null ) return false ; Stack < node > nodeStack = new Stack < node > ( ) ; nodeStack . push ( root ) ; while ( nodeStack . empty ( ) == false ) { node node = nodeStack . peek ( ) ; if ( node . data == x ) return true ; nodeStack . pop ( ) ; if ( node . right != null ) nodeStack . push ( node . right ) ; if ( node . left != null ) nodeStack . push ( node . left ) ; } return false ; } public static void main ( String [ ] args ) { node NewRoot = null ; node root = newNode ( 2 ) ; root . left = newNode ( 7 ) ; root . right = newNode ( 5 ) ; root . left . right = newNode ( 6 ) ; root . left . right . left = newNode ( 1 ) ; root . left . right . right = newNode ( 11 ) ; root . right . right = newNode ( 9 ) ; root . right . right . left = newNode ( 4 ) ; if ( iterativeSearch ( root , 6 ) ) System . out . println ( " Found " ) ; else System . out . println ( " Not ▁ Found " ) ; if ( iterativeSearch ( root , 12 ) ) System . out . println ( " Found " ) ; else System . out . println ( " Not ▁ Found " ) ; } }

Class/struct names: GFG, node
Java program:
class GFG { static boolean find ( String s1 , String s2 ) { int len = s1 . length ( ) , len_1 = s2 . length ( ) ; if ( len != len_1 ) { return false ; } int d [ ] = new int [ len ] ; d [ 0 ] = s2 . charAt ( 0 ) - s1 . charAt ( 0 ) ; for ( int i = 1 ; i < len ; i ++ ) { if ( s1 . charAt ( i ) > s2 . charAt ( i ) ) { return false ; } else { d [ i ] = s2 . charAt ( i ) - s1 . charAt ( i ) ; } } for ( int i = 0 ; i < len - 1 ; i ++ ) { if ( d [ i ] < d [ i + 1 ] ) { return false ; } } return true ; } public static void main ( String [ ] args ) { String s1 = " abcd " , s2 = " bcdd " ; if ( find ( s1 , s2 ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Index/key variables: i, len
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . lang . * ; class GFG { public static boolean ispalindrome ( int x ) { int ans = 0 ; int temp = x ; while ( temp > 0 ) { ans = 10 * ans + temp % 10 ; temp = temp / 10 ; } return ans == x ; } public static int SuperPalindromes ( int L , int R ) { int LIMIT = 100000 ; int ans = 0 ; for ( int i = 0 ; i < LIMIT ; i ++ ) { String s = Integer . toString ( i ) ; StringBuilder rs = new StringBuilder ( ) ; rs . append ( s . substring ( 0 , Math . max ( 1 , s . length ( ) - 1 ) ) ) ; String srs = rs . reverse ( ) . toString ( ) ; String p = s + srs ; int p_sq = ( int ) ( Math . pow ( Integer . parseInt ( p ) , 2 ) ) ; if ( p_sq > R ) { break ; } if ( p_sq >= L && ispalindrome ( p_sq ) ) { ans = ans + 1 ; } } for ( int i = 0 ; i < LIMIT ; i ++ ) { String s = Integer . toString ( i ) ; StringBuilder rs = new StringBuilder ( ) ; rs . append ( s ) ; rs = rs . reverse ( ) ; String p = s + rs ; int p_sq = ( int ) ( Math . pow ( Integer . parseInt ( p ) , 2 ) ) ; if ( p_sq > R ) { break ; } if ( p_sq >= L && ispalindrome ( p_sq ) ) { ans = ans + 1 ; } } return ans ; } public static void main ( String [ ] args ) { String L = "4" ; String R = "1000" ; System . out . println ( SuperPalindromes ( Integer . parseInt ( L ) , Integer . parseInt ( R ) ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static char NthCharacter ( int n ) { String s = " " ; int c = 1 ; for ( int i = 1 ; ; i ++ ) { if ( c < 10 ) s += Integer . toString ( c ) ; else { String s1 = " " ; int dup = c ; while ( dup > 0 ) { s1 += Integer . toString ( dup % 10 ) ; dup /= 10 ; } StringBuilder temp = new StringBuilder ( ) ; temp . append ( s1 ) ; temp = temp . reverse ( ) ; s += temp ; } c ++ ; if ( s . length ( ) >= n ) { return s . charAt ( n - 1 ) ; } } } public static void main ( String [ ] args ) { int n = 11 ; System . out . println ( NthCharacter ( n ) ) ; } }

Accumulator variables: c, dup, i, s, s1
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void solve ( String s , int k ) { int count = 0 , length = 0 , pos = 0 ; HashMap < Character , Integer > m = new HashMap < Character , Integer > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( m . containsKey ( s . charAt ( i ) ) ) m . put ( s . charAt ( i ) , m . get ( s . charAt ( i ) ) + 1 ) ; else m . put ( s . charAt ( i ) , 1 ) ; length ++ ; if ( length > k ) { m . put ( s . charAt ( pos ) , m . get ( s . charAt ( pos ) ) - 1 ) ; pos ++ ; length -- ; } if ( length == k && m . get ( s . charAt ( i ) ) == length ) count ++ ; } System . out . println ( count ) ; } public static void main ( String [ ] args ) { String s = " aaaabbbccdddd " ; int k = 4 ; solve ( s , k ) ; } }

Accumulator variables: count, i, length, pos
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int MAX = Integer . MAX_VALUE ; static HashMap < String , Integer > m = new HashMap < > ( ) ; static int Min = Integer . MAX_VALUE ; static int minOperation ( String s , int i , int j , int count ) { if ( ( i >= s . length ( ) && j < 0 ) || ( i == j ) ) { return MAX ; } if ( s . charAt ( i ) == s . charAt ( j ) || ( count >= Min ) ) { return count ; } String str = String . valueOf ( i ) + " | " + String . valueOf ( j ) ; if ( ! m . containsKey ( str ) ) { if ( i >= s . length ( ) ) { m . put ( str , minOperation ( s , i , j - 1 , count + 1 ) ) ; } else if ( j < 0 ) { m . put ( str , minOperation ( s , i + 1 , j , count + 1 ) ) ; } else { m . put ( str , Math . min ( minOperation ( s , i , j - 1 , count + 1 ) , minOperation ( s , i + 1 , j , count + 1 ) ) ) ; } } if ( m . get ( str ) < Min ) { Min = m . get ( str ) ; } return m . get ( str ) ; } public static void main ( String [ ] args ) { String s = " bacdefghipalop " ; int ans = minOperation ( s , 0 , s . length ( ) - 1 , 0 ) ; if ( ans == MAX ) { System . out . println ( - 1 ) ; } else { System . out . println ( ans ) ; } } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static boolean solve ( String n , int l ) { if ( l < 3 ) { if ( Integer . parseInt ( n ) % 8 == 0 ) return true ; n = new String ( ( new StringBuilder ( ) ) . append ( n ) . reverse ( ) ) ; if ( Integer . parseInt ( n ) % 8 == 0 ) return true ; return false ; } int [ ] hash = new int [ 10 ] ; for ( int i = 0 ; i < l ; i ++ ) hash [ n . charAt ( i ) - '0' ] ++ ; for ( int i = 104 ; i < 1000 ; i += 8 ) { int dup = i ; int [ ] freq = new int [ 10 ] ; freq [ dup % 10 ] ++ ; dup = dup / 10 ; freq [ dup % 10 ] ++ ; dup = dup / 10 ; freq [ dup % 10 ] ++ ; dup = i ; if ( freq [ dup % 10 ] > hash [ dup % 10 ] ) continue ; dup = dup / 10 ; if ( freq [ dup % 10 ] > hash [ dup % 10 ] ) continue ; dup = dup / 10 ; if ( freq [ dup % 10 ] > hash [ dup % 10 ] ) continue ; return true ; } return false ; } public static void main ( String [ ] args ) { String number = "31462708" ; int l = number . length ( ) ; if ( solve ( number , l ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static String newString ( String s , int k ) { String X = " " ; while ( s . length ( ) > 0 ) { char temp = s . charAt ( 0 ) ; for ( int i = 1 ; i < k && i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) < temp ) { temp = s . charAt ( i ) ; } } X = X + temp ; for ( int i = 0 ; i < k ; i ++ ) { if ( s . charAt ( i ) == temp ) { s = s . substring ( 0 , i ) + s . substring ( i + 1 ) ; break ; } } } return X ; } public static void main ( String [ ] args ) { String s = " gaurang " ; int k = 3 ; System . out . println ( newString ( s , k ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class Node { int data ; Node left , right ; Node ( int item ) { data = item ; left = right = null ; } } class BinaryTree { Node root ; void printInorder ( Node node ) { if ( node != null ) { printInorder ( node . left ) ; System . out . print ( node . data + " ▁ " ) ; printInorder ( node . right ) ; } } Node RemoveHalfNodes ( Node node ) { if ( node == null ) return null ; node . left = RemoveHalfNodes ( node . left ) ; node . right = RemoveHalfNodes ( node . right ) ; if ( node . left == null && node . right == null ) return node ; if ( node . left == null ) { Node new_root = node . right ; return new_root ; } if ( node . right == null ) { Node new_root = node . left ; return new_root ; } return node ; } public static void main ( String args [ ] ) { BinaryTree tree = new BinaryTree ( ) ; Node NewRoot = null ; tree . root = new Node ( 2 ) ; tree . root . left = new Node ( 7 ) ; tree . root . right = new Node ( 5 ) ; tree . root . left . right = new Node ( 6 ) ; tree . root . left . right . left = new Node ( 1 ) ; tree . root . left . right . right = new Node ( 11 ) ; tree . root . right . right = new Node ( 9 ) ; tree . root . right . right . left = new Node ( 4 ) ; System . out . println ( " the ▁ inorder ▁ traversal ▁ of ▁ tree ▁ is ▁ " ) ; tree . printInorder ( tree . root ) ; NewRoot = tree . RemoveHalfNodes ( tree . root ) ; System . out . print ( " Inorder traversal of the modified tree "); tree . printInorder ( NewRoot ) ; } }

Class/struct names: BinaryTree, Node
Java program:
class GFG { public static boolean isPalindromePossible ( String input ) { int len = input . length ( ) , i ; char [ ] charStr = input . toCharArray ( ) ; int diffCount = 0 ; char [ ] [ ] diff = new char [ 2 ] [ 2 ] ; for ( i = 0 ; i < len / 2 ; i ++ ) { if ( charStr [ i ] != charStr [ len - i - 1 ] ) { if ( diffCount == 2 ) return false ; diff [ diffCount ] [ 0 ] = charStr [ i ] ; diff [ diffCount ++ ] [ 1 ] = charStr [ len - i - 1 ] ; } } switch ( diffCount ) { case 0 : return true ; case 1 : char midChar = charStr [ i ] ; if ( len % 2 != 0 && ( diff [ 0 ] [ 0 ] == midChar diff [ 0 ] [ 1 ] == midChar ) ) return true ; case 2 : if ( ( diff [ 0 ] [ 0 ] == diff [ 1 ] [ 0 ] && diff [ 0 ] [ 1 ] == diff [ 1 ] [ 1 ] ) || ( diff [ 0 ] [ 0 ] == diff [ 1 ] [ 1 ] && diff [ 0 ] [ 1 ] == diff [ 1 ] [ 0 ] ) ) return true ; } return false ; } public static void main ( String [ ] args ) { System . out . println ( isPalindromePossible ( " bbg " ) ) ; System . out . println ( isPalindromePossible ( " bdababd " ) ) ; System . out . println ( isPalindromePossible ( " gcagac " ) ) ; } }

Index/key variables: diffCount, i
Accumulator variables: diffCount, i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class Node { static void strToBinary ( String s ) { int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int val = Integer . valueOf ( s . charAt ( i ) ) ; String bin = " " ; while ( val > 0 ) { if ( val % 2 == 1 ) { bin += '1' ; } else bin += '0' ; val /= 2 ; } bin = reverse ( bin ) ; System . out . print ( bin + " ▁ " ) ; } } static String reverse ( String input ) { char [ ] a = input . toCharArray ( ) ; int l , r = 0 ; r = a . length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . valueOf ( a ) ; } public static void main ( String [ ] args ) { String s = " geeks " ; strToBinary ( s ) ; } }

Index/key variables: l, r
Accumulator variables: bin, i, l, r, val
Iterator variables: i, l
Class/struct names: Node
Java program:
class solution { static int binarySearch ( String arr [ ] , int low , int high , String x ) { if ( low > high ) return - 1 ; int mid = ( low + high ) / 2 ; if ( arr [ mid ] == " " ) { int left = mid - 1 ; int right = mid + 1 ; while ( true ) { if ( left < low && right > high ) return - 1 ; if ( left >= low && arr [ left ] != " " ) { mid = left ; break ; } else if ( right <= high && arr [ right ] != " " ) { mid = right ; break ; } left -- ; right ++ ; } } if ( arr [ mid ] == x ) return mid ; else if ( x . compareTo ( arr [ mid ] ) < 0 ) return binarySearch ( arr , low , mid - 1 , x ) ; else return binarySearch ( arr , mid + 1 , high , x ) ; } static int sparseSearch ( String arr [ ] , String x , int n ) { return binarySearch ( arr , 0 , n - 1 , x ) ; } public static void main ( String args [ ] ) { String arr [ ] = { " for " , " geeks " , " " , " " , " " , " " , " ide " , " practice " , " " , " " , " " , " quiz " } ; String x = " geeks " ; int n = x . length ( ) ; int index = sparseSearch ( arr , x , n ) ; if ( index != - 1 ) System . out . println ( x + " ▁ found ▁ at ▁ index ▁ " + index ) ; else System . out . println ( x + " ▁ not ▁ found " ) ; } }

Index/key variables: left, mid, right
Accumulator variables: left, right
Class/struct names: solution
Java program:
import java . io . * ; import java . util . * ; class Solution { static int factorial ( int n ) { int f = 1 ; for ( int i = 1 ; i <= n ; i ++ ) f = f * i ; return f ; } static void print ( char [ ] temp ) { for ( int i = 0 ; i < temp . length ; i ++ ) System . out . print ( temp [ i ] ) ; System . out . println ( ) ; } static int calculateTotal ( char [ ] temp , int n ) { int f = factorial ( n ) ; HashMap < Character , Integer > hm = new HashMap < Character , Integer > ( ) ; for ( int i = 0 ; i < temp . length ; i ++ ) { if ( hm . containsKey ( temp [ i ] ) ) hm . put ( temp [ i ] , hm . get ( temp [ i ] ) + 1 ) ; else hm . put ( temp [ i ] , 1 ) ; } for ( Map . Entry e : hm . entrySet ( ) ) { Integer x = ( Integer ) e . getValue ( ) ; if ( x > 1 ) { int temp5 = factorial ( x ) ; f = f / temp5 ; } } return f ; } static void nextPermutation ( char [ ] temp ) { int i ; for ( i = temp . length - 1 ; i > 0 ; i -- ) if ( temp [ i ] > temp [ i - 1 ] ) break ; int min = i ; int j , x = temp [ i - 1 ] ; for ( j = i + 1 ; j < temp . length ; j ++ ) if ( ( temp [ j ] < temp [ min ] ) && ( temp [ j ] > x ) ) min = j ; char temp_to_swap ; temp_to_swap = temp [ i - 1 ] ; temp [ i - 1 ] = temp [ min ] ; temp [ min ] = temp_to_swap ; Arrays . sort ( temp , i , temp . length ) ; print ( temp ) ; } static void printAllPermutations ( String s ) { char temp [ ] = s . toCharArray ( ) ; Arrays . sort ( temp ) ; print ( temp ) ; int total = calculateTotal ( temp , temp . length ) ; for ( int i = 1 ; i < total ; i ++ ) nextPermutation ( temp ) ; } public static void main ( String [ ] args ) { String s = " AAB " ; printAllPermutations ( s ) ; } }

Index/key variables: i, j, min
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: Solution
Java program:
class GFG { static class Node { int data ; Node left , right ; } ; static Node newNode ( int data ) { Node temp = new Node ( ) ; temp . data = data ; temp . left = temp . right = null ; return temp ; } static void swapEveryKLevelUtil ( Node root , int level , int k ) { if ( root == null || ( root . left == null && root . right == null ) ) return ; if ( ( level + 1 ) % k == 0 ) { Node temp = root . left ; root . left = root . right ; root . right = temp ; } swapEveryKLevelUtil ( root . left , level + 1 , k ) ; swapEveryKLevelUtil ( root . right , level + 1 , k ) ; } static void swapEveryKLevel ( Node root , int k ) { swapEveryKLevelUtil ( root , 1 , k ) ; } static void inorder ( Node root ) { if ( root == null ) return ; inorder ( root . left ) ; System . out . print ( root . data + " ▁ " ) ; inorder ( root . right ) ; } public static void main ( String args [ ] ) { Node root = newNode ( 1 ) ; root . left = newNode ( 2 ) ; root . right = newNode ( 3 ) ; root . left . left = newNode ( 4 ) ; root . right . right = newNode ( 8 ) ; root . right . left = newNode ( 7 ) ; int k = 2 ; System . out . println ( " Before ▁ swap ▁ node ▁ : " ) ; inorder ( root ) ; swapEveryKLevel ( root , k ) ; System . out . println ( " After swap Node : " );  inorder ( root ) ; } }

Class/struct names: GFG, Node
Java program:
import java . util . * ; class GFG { static String printSequence ( String arr [ ] , String input ) { String output = " " ; int n = input . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( input . charAt ( i ) == ' ▁ ' ) output = output + "0" ; else { int position = input . charAt ( i ) - ' A ' ; output = output + arr [ position ] ; } } return output ; } public static void main ( String [ ] args ) { String str [ ] = { "2" , "22" , "222" , "3" , "33" , "333" , "4" , "44" , "444" , "5" , "55" , "555" , "6" , "66" , "666" , "7" , "77" , "777" , "7777" , "8" , "88" , "888" , "9" , "99" , "999" , "9999" } ; String input = " GEEKSFORGEEKS " ; System . out . println ( printSequence ( str , input ) ) ; } }

Index/key variables: position
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GfG { static int findLUSlength ( String a , String b ) { HashMap < String , Integer > map = new HashMap < String , Integer > ( ) ; Vector < String > strArr = new Vector < String > ( ) ; strArr . add ( a ) ; strArr . add ( b ) ; for ( String s : strArr ) { for ( int i = 0 ; i < ( 1 << s . length ( ) ) ; i ++ ) { String t = " " ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { if ( ( ( i >> j ) & 1 ) != 0 ) t += s . charAt ( j ) ; } if ( map . containsKey ( t ) ) map . put ( t , map . get ( t ) + 1 ) ; else map . put ( t , 1 ) ; } } int res = 0 ; for ( HashMap . Entry < String , Integer > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) == 1 ) res = Math . max ( res , entry . getKey ( ) . length ( ) ) ; } return res ; } public static void main ( String [ ] args ) { String a = " abcdabcd " , b = " abcabc " ; System . out . println ( findLUSlength ( a , b ) ) ; } }

Accumulator variables: i, j, t
Iterator variables: i, j, s
Class/struct names: GfG
Java program:
import java . io . * ; class GFG { public static String round ( String s , int n ) { char [ ] c = s . toCharArray ( ) ; if ( c [ n - 1 ] == '0' ) return s ; else if ( c [ n - 1 ] == '1' c [ n - 1 ] == '2' c [ n - 1 ] == '3' c [ n - 1 ] == '4' c [ n - 1 ] == '5' ) { c [ n - 1 ] = '0' ; return new String ( c ) ; } else { c [ n - 1 ] = '0' ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( c [ i ] == '9' ) c [ i ] = '0' ; else { int t = c [ i ] - '0' + 1 ; c [ i ] = ( char ) ( 48 + t ) ; break ; } } } String s1 = new String ( c ) ; if ( s1 . charAt ( 0 ) == '0' ) s1 = "1" + s1 ; return s1 ; } public static void main ( String [ ] args ) { String s = "5748965412485599999874589965999" ; int n = s . length ( ) ; System . out . println ( round ( s , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG