Driver code
public static void main ( String [ ] args ) { int L [ ] = { 1 , 8 , 21 } ; int R [ ] = { 4 , 10 , 23 } ; int n = L . length ; int k = 6 ; System . out . println ( getKthElement ( n , k , L , R ) ) ; } }