codeparrot/xlcost-text-to-code huggingface dataset:
Minimize moves required to make array elements equal by incrementing and decrementing pairs | Set 2 | Java program for the above approach ; Function to find the minimum number of increment and decrement of pairs required to make all array elements equal ; Stores the sum of the array ; If sum is not divisible by N ; Update sum ; Store the minimum number of operations ; Iterate while i is less than N ; Add absolute difference of current element with k to ans ; Increase i bye 1 ; Return the value in ans2 ; Driver Code ; Given Input ; Function Call
import java . util . * ; class GFG { static int find ( ArrayList < Integer > arr , int N ) { int Sum = 0 ; for ( int item : arr ) Sum += item ; if ( Sum % N == 1 ) return - 1 ; int k = Sum / N ; int ans = 0 ; int i = 0 ; while ( i < N ) { ans = ans + Math . abs ( k - arr . get ( i ) ) ; i += 1 ; } return ans / 2 ; } public static void main ( String [ ] args ) { ArrayList < Integer > arr = new ArrayList < > ( ) ; arr . add ( 5 ) ; arr . add ( 4 ) ; arr . add ( 1 ) ; arr . add ( 10 ) ; int N = arr . size ( ) ; System . out . println ( find ( arr , N ) ) ; } }
Convert A into B by incrementing or decrementing 1 , 2 , or 5 any number of times | Java program for the above approach ; Function to find minimum number of moves required to convert A into B ; Stores the minimum number of moves required ; Stores the absolute difference ; FInd the number of moves ; Return cnt ; Driver Code ; Input ; Function call
import java . io . * ; class GFG { static int minimumSteps ( int a , int b ) { int cnt = 0 ; a = Math . abs ( a - b ) ; cnt = ( a / 5 ) + ( a % 5 ) / 2 + ( a % 5 ) % 2 ; return cnt ; } public static void main ( String [ ] args ) { int A = 3 , B = 9 ; System . out . println ( minimumSteps ( A , B ) ) ; } }
Minimum distance between duplicates in a String | Java Program to find the minimum distance between two repeating characters in a String using two pointers technique ; This function is used to find minimum distance between any two repeating characters using two - pointers and hashing technique ; hash array to store character 's last index ; Traverse through the String ; If the character is present in visited array find if its forming minimum distance ; update current character 's last index ; Return minimum distance found , else - 1 ; Driver code ; Given Input ; Function Call
import java . util . * ; class GFG { static int shortestDistance ( String s , int n ) { int [ ] visited = new int [ 128 ] ; Arrays . fill ( visited , - 1 ) ; int ans = Integer . MAX_VALUE ; for ( int right = 0 ; right < n ; right ++ ) { char c = s . charAt ( right ) ; int left = visited ; if ( left != - 1 ) ans = Math . min ( ans , right - left - 1 ) ; visited = right ; } return ans == Integer . MAX_VALUE ? - 1 : ans ; } public static void main ( String [ ] args ) { String s = " geeksforgeeks " ; int n = 13 ; System . out . print ( shortestDistance ( s , n ) ) ; } }
Lexicographically smallest string which is not a subsequence of given string | Java program for the above approach ; Function to find lexicographically smallest string that is not a subsequence of S ; variable to store frequency of ' a ' ; calculate frequency of ' a ' ; Initialize string consisting of freq number of ' a ' ; change the last digit to ' b ' ; add another ' a ' to the string ; return tha answer string ; Driver Code ; Input ; Function call
import java . util . * ; public class GFG { static String smallestNonSubsequence ( String S , int N ) { int freq = 0 ; for ( int i = 0 ; i < N ; i ++ ) if ( S . charAt ( i ) == ' a ' ) freq ++ ; String ans = " " ; for ( int i = 0 ; i < f req ; i ++ ) { ans += ' a ' ; } if ( freq == N ) ans = ans . replace ( ans . charAt ( freq - 1 ) , ' b ' ) ; else ans += ' a ' ; return ans ; } public static void main ( String args [ ] ) { String S = " abcdefghijklmnopqrstuvwxyz " ; int N = S . length ( ) ; System . out . println ( smallestNonSubsequence ( S , N ) ) ; } }
Print all numbers that can be obtained by adding A or B to N exactly M times | Java program for tha above approach ; Function to find all possible numbers that can be obtained by adding A or B to N exactly M times ; For maintaining increasing order ; Smallest number that can be obtained ; If A and B are equal , then only one number can be obtained , i . e . N + M * A ; For finding others numbers , subtract A from number once and add B to number once ; Driver Code ; Given Input ; Function Call
import java . util . * ; class GFG { static void possibleNumbers ( int N , int M , int A , int B ) { if ( A > B ) { int temp = A ; A = B ; B = temp ; } int number = N + M * A ; System . out . print ( number + " ▁ " ) ; if ( A != B ) { for ( int i = 0 ; i < M ; i ++ ) { number = number - A + B ; System . out . print ( number + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int N = 5 , M = 3 , A = 4 , B = 6 ; possibleNumbers ( N , M , A , B ) ; } }
Maximize number of circular buildings that can be covered by L length wire | Java program for the above approach ; Function to find the maximum number of buildings covered ; Store the current sum ; Traverse the array ; Add the length of wire required for current building to cur_sum ; Add extra unit distance 1 ; If curr_sum <= length of wire increment count by 1 ; If curr_sum > length of wire increment start by 1 and decrement count by 1 and update the new curr_sum ; Update the max_count ; Return the max_count ; Driver Code ; Given Input ; Size of the array ; Function Call
import java . io . * ; class GFG { static final double Pi = 3.141592 ; static int MaxBuildingsCovered ( int arr [ ] , int N , int L ) { double curr_sum = 0 ; int start = 0 , curr_count = 0 , max_count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { curr_sum = curr_sum + ( ( double ) arr [ i ] * Pi ) ; if ( i != 0 ) curr_sum += 1 ; if ( curr_sum <= L ) { curr_count ++ ; } else if ( curr_sum > L ) { curr_sum = curr_sum - ( ( double ) arr [ start ] * Pi ) ; curr_sum -= 1 ; start ++ ; curr_count -- ; } max_count = Math . max ( curr_count , max_count ) ; } return max_count ; } public static void main ( String [ ] args ) { int arr [ ] = { 4 , 1 , 6 , 2 } ; int L = 24 ; int N = arr . length ; System . out . println ( MaxBuildingsCovered ( arr , N , L ) ) ; } }
Count numbers less than N whose Bitwise AND with N is zero | Java program for the above approach ; Function to count number of unset bits in the integer N ; Stores the number of unset bits in N ; Check if N is even ; Increment the value of c ; Right shift N by 1 ; Return the value of count of unset bits ; Function to count numbers whose Bitwise AND with N equal to 0 ; Stores the number of unset bits in N ; Print the value of 2 to the power of unsetBits ; Driver Code
import java . util . * ; class GFG { static int countUnsetBits ( int N ) { int c = 0 ; while ( N != 0 ) { if ( N % 2 == 0 ) { c += 1 ; } N = N >> 1 ; } return c ; } static void countBitwiseZero ( int N ) { int unsetBits = countUnsetBits ( N ) ; System . out . print ( 1 << unsetBits ) ; } public static void main ( String [ ] args ) { int N = 9 ; countBitwiseZero ( N ) ; } }
Check if a Binary String can be split into disjoint subsequences which are equal to "010" | Java program for the above approach ; Function to check if the given string can be partitioned into a number of subsequences all of which are equal to "010" ; Store the size of the string ; Store the count of 0 s and 1 s ; Traverse the given string in the forward direction ; If the character is '0' , increment count_0 by 1 ; If the character is '1' increment count_1 by 1 ; If at any point , count_1 > count_0 , return false ; If count_0 is not equal to twice count_1 , return false ; Reset the value of count_0 and count_1 ; Traverse the string in the reverse direction ; If the character is '0' increment count_0 ; If the character is '1' increment count_1 ; If count_1 > count_0 , return false ; Driver Code ; Given string ; Function Call
public class MyClass { static boolean isPossible ( String s ) { int n = s . length ( ) ; int count_0 = 0 , count_1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == '0' ) ++ count_0 ; else ++ count_1 ; if ( count_1 > count_0 ) return false ; } if ( count_0 != ( 2 * count_1 ) ) return false ; count_0 = 0 ; count_1 = 0 ; for ( int i = n - 1 ; i >= 0 ; -- i ) { if ( s . charAt ( i ) == '0' ) ++ count_0 ; else ++ count_1 ; if ( count_1 > count_0 ) return false ; } return true ; } public static void main ( String args [ ] ) { String s = "010100" ; if ( isPossible ( s ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }
Minimum number of bricks that can be intersected | Java program for the above approach ; Function to find a line across a wall such that it intersects minimum number of bricks ; Declare a hashmap ; Store the maximum number of brick ending a point on x - axis ; Iterate over all the rows ; Initialize width as 0 ; Iterate over individual bricks ; Add the width of the current brick to the total width ; Increment number of bricks ending at this width position ; Update the variable , res ; Print the answer ; Driver code ; Given Input ; Function Call
import java . util . ArrayList ; import java . util . Arrays ; import java . util . HashMap ; public class GFG { static void leastBricks ( ArrayList < ArrayList < Integer > > wall ) { HashMap < Integer , Integer > map = new HashMap < > ( ) ; int res = 0 ; for ( ArrayList < Integer > list : wall ) { int width = 0 ; for ( int i = 0 ; i < list . size ( ) - 1 ; i ++ ) { width += list . get ( i ) ; map . put ( width , map . getOrDefault ( width , 0 ) + 1 ) ; res = Math . max ( res , map . getOrDefault ( width , 0 ) ) ; } } System . out . println ( wall . size ( ) - res ) ; } public static void main ( String [ ] args ) { ArrayList < ArrayList < Integer > > arr = new ArrayList < > ( ) ; arr . add ( new ArrayList < > ( Arrays . asList ( 1 , 2 , 2 , 1 ) ) ) ; arr . add ( new ArrayList < > ( Arrays . asList ( 3 , 1 , 2 ) ) ) ; arr . add ( new ArrayList < > ( Arrays . asList ( 1 , 3 , 2 ) ) ) ; arr . add ( new ArrayList < > ( Arrays . asList ( 2 , 4 ) ) ) ; arr . add ( new ArrayList < > ( Arrays . asList ( 3 , 1 , 2 ) ) ) ; arr . add ( new ArrayList < > ( Arrays . asList ( 1 , 3 , 1 , 1 ) ) ) ; leastBricks ( arr ) ; } }
Find an N | Java implementation of the above approach ; Function to print the required permutation ; Driver Code
import java . util . * ; class GFG { static void findPermutation ( int N ) { for ( int i = 1 ; i <= N ; i ++ ) System . out . print ( i + " ▁ " ) ; } public static void main ( String [ ] args ) { int N = 5 ; findPermutation ( N ) ; } }
Maximize count of distinct profits possible by N transactions | Java program for the above approach ; Function to count distinct profits possible ; Stores the minimum total profit ; Stores the maximum total profit ; Return count of distinct profits ; Driver code ; Input ; Function call
import java . util . Arrays ; class GFG { static int numberOfWays ( int N , int X , int Y ) { int S1 = ( N - 1 ) * X + Y ; int S2 = ( N - 1 ) * Y + X ; return ( S2 - S1 + 1 ) ; } public static void main ( String [ ] args ) { int N = 3 ; int X = 13 ; int Y = 15 ; System . out . println ( numberOfWays ( N , X , Y ) ) ; } }
Minimum number of operations required to make a permutation of first N natural numbers equal | Java program for the above approach ; Function to find the minimum number of operations required to make all array elements equal ; Store the count of operations required ; Increment by K - 1 , as the last element will be used again for the next K consecutive elements ; Increment count by 1 ; Return the result ; Driver Code ; Given Input
import java . io . * ; class GFG { static int MinimumOperations ( int [ ] A , int N , int K ) { int Count = 0 ; int i = 0 ; while ( i < N - 1 ) { i = i + K - 1 ; Count ++ ; } return Count ; } public static void main ( String [ ] args ) { int [ ] A = { 5 , 4 , 3 , 1 , 2 } ; int K = 3 ; int N = A . length ; System . out . println ( MinimumOperations ( A , N , K ) ) ; } }
Consecutive Prime numbers greater than equal to given number . | Java program for the above approach ; Function to check prime . ; It means it is not a prime ; No factor other than 1 therefore prime number ; Function to find out the required consecutive primes . ; Finding first prime just less than sqrt ( n ) . ; Finding prime just greater than sqrt ( n ) . ; Product of both prime is greater than n then print it ; Finding prime greater than second ; Driver code
import java . io . * ; import java . util . * ; class GFG { static boolean is_prime ( long n ) { if ( n == 1 ) { return false ; } for ( long i = 2 ; i <= ( long ) Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { return false ; } } return true ; } static void consecutive_primes ( long n ) { long first = - 1 , second = - 1 ; for ( long i = ( long ) Math . sqrt ( n ) ; i >= 2 ; i -- ) { if ( is_prime ( i ) ) { first = i ; break ; } } for ( long i = ( long ) Math . sqrt ( n ) + 1 ; i <= n / 2 ; i ++ ) { if ( is_prime ( i ) ) { second = i ; break ; } } if ( first * second >= n ) { System . out . println ( first + " ▁ " + second ) ; } else { for ( long i = second + 1 ; i <= n ; i ++ ) { if ( is_prime ( i ) ) { System . out . println ( second + " ▁ " + i ) ; return ; } } } } public static void main ( String args [ ] ) { long n = 14 ; consecutive_primes ( n ) ; } }
Reorder characters of a string to valid English representations of digits | Java program to implement the above approach ; Function to construct the original set of digits from the string in ascending order ; Store the unique characters corresponding to word and number ; Store the required result ; Store the frequency of each character of S ; Traverse the unique characters ; Store the count of k [ i ] in S ; Traverse the corresponding word ; Decrement the frequency of characters by x ; Append the digit x times to ans ; Sort the digits in ascending order ; Driver Code ; Given string , s ; Function Call
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static String construct_digits ( String s ) { char [ ] k = { ' z ' , ' w ' , ' u ' , ' x ' , ' g ' , ' h ' , ' o ' , ' f ' , ' v ' , ' i ' } ; String [ ] l = { " zero " , " two " , " four " , " six " , " eight " , " three " , " one " , " five " , " seven " , " nine " } ; int [ ] c = { 0 , 2 , 4 , 6 , 8 , 3 , 1 , 5 , 7 , 9 } ; List < Integer > ans = new ArrayList < > ( ) ; HashMap < Character , Integer > d = new HashMap < > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { d . put ( s . charAt ( i ) , d . getOrDefault ( s . charAt ( i ) , 0 ) + 1 ) ; } for ( int i = 0 ; i < k . length ; i ++ ) { int x = 0 ; if ( d . containsKey ( k [ i ] ) ) x = d . get ( k [ i ] ) ; for ( int j = 0 ; j < l [ i ] . length ( ) ; j ++ ) { if ( d . containsKey ( l [ i ] . charAt ( j ) ) ) d . put ( l [ i ] . charAt ( j ) , d . get ( l [ i ] . charAt ( j ) ) - x ) ; } for ( int j = 0 ; j < x ; j ++ ) ans . add ( c [ i ] ) ; } Collections . sort ( ans ) ; String str = " " ; for ( int val : ans ) str += val ; return str ; } public static void main ( String [ ] args ) { String s = " fviefuro " ; System . out . println ( construct_digits ( s ) ) ; } }
Minimum decrements required to make all pairs of adjacent matrix elements distinct | Java program for the above approach ; Function to count minimum number of operations required ; Case 1 : ; Case 2 : ; Print the minimum number of operations required ; Driver Code ; The given matrix ; Function Call to count the minimum number of decrements required
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void countDecrements ( long arr [ ] [ ] ) { int n = arr . length ; int m = arr [ 0 ] . length ; int count_1 = 0 ; int count_2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( ( i + j ) % 2 == arr [ i ] [ j ] % 2 ) count_1 ++ ; if ( 1 - ( i + j ) % 2 == arr [ i ] [ j ] % 2 ) count_2 ++ ; } } System . out . println ( Math . min ( count_1 , count_2 ) ) ; } public static void main ( String [ ] args ) { long arr [ ] [ ] = { { 1 , 2 , 3 } , { 1 , 2 , 3 } , { 1 , 2 , 3 } } ; countDecrements ( arr ) ; } }
Check if X can be converted to Y by converting to 3 * ( X / 2 ) or X | Java program for the above approach ; Function to check if X can be made equal to Y by converting X to ( 3 * X / 2 ) or ( X - 1 ) ; Conditions for possible conversion ; Otherwise , conversion is not possible ; Driver Code
class GFG { static void check ( int X , int Y ) { if ( X > 3 ) { System . out . print ( " Yes " ) ; } else if ( X == 1 && Y == 1 ) { System . out . print ( " Yes " ) ; } else if ( X == 2 && Y <= 3 ) { System . out . print ( " Yes " ) ; } else if ( X == 3 && Y <= 3 ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } public static void main ( String [ ] args ) { int X = 6 , Y = 8 ; check ( X , Y ) ; } }
Count distinct sum of pairs possible from a given range | Java program for the above approach ; Function to count distinct sum of pairs possible from the range [ L , R ] ; Return the count of distinct sum of pairs ; Driver Code
import java . io . * ; class GFG { static int distIntegers ( int L , int R ) { return 2 * R - 2 * L + 1 ; } public static void main ( String [ ] args ) { int L = 3 , R = 8 ; System . out . println ( distIntegers ( L , R ) ) ; } }
Count subarrays having even Bitwise XOR | Java program for the above approach ; Function to count subarrays having even Bitwise XOR ; Store the required result ; Stores count of subarrays with even and odd XOR values ; Stores Bitwise XOR of current subarray ; Traverse the array ; Update current Xor ; If XOR is even ; Update ans ; Increment count of subarrays with even XOR ; Otherwise , increment count of subarrays with odd XOR ; Print the result ; Driver Code ; Given array ; Stores the size of the array
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void evenXorSubarray ( int arr [ ] , int n ) { int ans = 0 ; int freq [ ] = { 0 , 0 } ; int XOR = 0 ; for ( int i = 0 ; i < n ; i ++ ) { XOR = XOR ^ arr [ i ] ; if ( XOR % 2 == 0 ) { ans += freq [ 0 ] + 1 ; freq [ 0 ] ++ ; } else { ans += freq [ 1 ] ; freq [ 1 ] ++ ; } } System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int N = arr . length ; evenXorSubarray ( arr , N ) ; } }
Count occurrences of an element in a matrix of size N * N generated such that each element is equal to product of its indices | Java program for the above approach ; Function to count the occurrences of X in the generated square matrix ; Stores the required result ; Iterate upto square root of X ; Check if i divides X ; Store the quotient obtained on dividing X by i ; If both the numbers fall in the range , update count ; Return the result ; Driver code ; Given N and X ; Function Call
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static int countOccurrences ( int N , int X ) { int count = 0 ; for ( int i = 1 ; i < Math . sqrt ( X ) ; i ++ ) { if ( X % i == 0 ) { int a = i ; int b = X / i ; if ( a <= N && b <= N ) { if ( a == b ) count += 1 ; else count += 2 ; } } } return count ; } public static void main ( String [ ] args ) { int N = 7 ; int X = 12 ; System . out . println ( countOccurrences ( N , X ) ) ; } }
Maximize array product by changing any array element arr [ i ] to ( | Java program for the above approach ; Function to find array with maximum product by changing array elements to ( - 1 ) arr [ i ] - 1 ; Traverse the array ; Applying the operation on all the positive elements ; Stores maximum element in array ; Stores index of maximum element ; Check if current element is greater than the maximum element ; Find index of the maximum element ; Perform the operation on the maximum element ; Print the elements of the array ; Driver Code ; Function Call
import java . io . * ; class GFG { static void findArrayWithMaxProduct ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; i ++ ) if ( arr [ i ] >= 0 ) { arr [ i ] = - arr [ i ] - 1 ; } if ( N % 2 == 1 ) { int max_element = - 1 ; int index = - 1 ; for ( int i = 0 ; i < N ; i ++ ) if ( Math . abs ( arr [ i ] ) > max_element ) { max_element = Math . abs ( arr [ i ] ) ; index = i ; } arr [ index ] = - arr [ index ] - 1 ; } for ( int i = 0 ; i < N ; i ++ ) System . out . print ( arr [ i ] + " ▁ " ) ; } public static void main ( String [ ] args ) { int arr [ ] = { - 3 , 0 , 1 } ; int N = arr . length ; findArrayWithMaxProduct ( arr , N ) ; } }
Lexicographically smallest permutation of first N natural numbers having K perfect indices | Java program for the above approach ; Function to print the lexicographically smallest permutation with K perfect indices ; Iterator to traverse the array ; Traverse first K array indices ; Traverse remaining indices ; Driver Code
import java . util . * ; class GFG { static void findPerfectIndex ( int N , int K ) { int i = 0 ; for ( ; i < K ; i ++ ) { System . out . print ( ( N - K + 1 ) + i + " ▁ " ) ; } for ( ; i < N ; i ++ ) { System . out . print ( i - K + 1 + " ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 10 , K = 3 ; findPerfectIndex ( N , K ) ; } }
Count pairs having distinct sum from a given range | Java program for the above approach ; Function to count pairs made up of elements from the range [ L , R ] having distinct sum ; Stores the least sum which can be formed by the pairs ; Stores the highest sum which can be formed by the pairs ; Stores the count of pairs having distinct sum ; Print the count of pairs ; Driver Code ; Function call to count the number of pairs having distinct sum in the range [ L , R ]
import java . io . * ; class GFG { static void countPairs ( long L , long R ) { long firstNum = 2 * L ; long lastNum = 2 * R ; long Cntpairs = lastNum - firstNum + 1 ; System . out . println ( Cntpairs ) ; } public static void main ( String [ ] args ) { long L = 2 , R = 3 ; countPairs ( L , R ) ; } }
Count pairs from an array whose Bitwise OR is greater than Bitwise AND | Java program for the above approach ; Function to count the number of pairs ( i , j ) their Bitwise OR is greater than Bitwise AND ; Total number of pairs possible from the array ; Stores frequency of each array element ; Traverse the array A [ ] ; Increment ump [ A [ i ] ] by 1 ; Traverse the Hashmap ump ; Subtract those pairs ( i , j ) from count which has the same element on index i and j ( i < j ) ; Print the result ; Driver Code ; Function Call
import java . util . * ; class GFG { static void countPairs ( int A [ ] , int n ) { int count = ( n * ( n - 1 ) ) / 2 ; Map < Integer , Integer > mp = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . containsKey ( A [ i ] ) ) { mp . put ( A [ i ] , mp . get ( A [ i ] ) + 1 ) ; } else { mp . put ( A [ i ] , 1 ) ; } } for ( Map . Entry < Integer , Integer > it : mp . entrySet ( ) ) { int c = it . getValue ( ) ; count = count - ( c * ( c - 1 ) ) / 2 ; } System . out . print ( count ) ; } public static void main ( String [ ] args ) { int A [ ] = { 1 , 4 , 7 } ; int N = A . length ; countPairs ( A , N ) ; } }
Check if a Rook can reach the given destination in a single move | Java program for the above approach ; Function to check if it is possible to reach destination in a single move by a rook ; Driver code ; Given arrays
import java . util . * ; import java . lang . * ; class GFG { static String check ( int current_row , int current_col , int destination_row , int destination_col ) { if ( current_row == destination_row ) return " POSSIBLE " ; else if ( current_col == destination_col ) return " POSSIBLE " ; else return " NOT ▁ POSSIBLE " ; } public static void main ( String [ ] args ) { int current_row = 8 ; int current_col = 8 ; int destination_row = 8 ; int destination_col = 4 ; String output = check ( current_row , current_col , destination_row , destination_col ) ; System . out . println ( output ) ; } }