String formed with middle character of every right substring followed by left sequentially | Function to decrypt and prlet the new String ; If the whole String has been traversed ; To calculate middle index of the String ; Prlet the character at middle index ; Recursively call for right - subString ; Recursive call for left - subString ; Driver Code
function decrypt ( Str , Start , End ) { if ( Start > End ) { return ; } let mid = ( Start + End ) >> 1 ; document . write ( Str [ mid ] ) ; decrypt ( Str , mid + 1 , End ) ; decrypt ( Str , Start , mid - 1 ) ; } let N = 4 ; let Str = " " ; decrypt ( Str , 0 , N - 1 ) ; document . write ( " " ) ; N = 6 ; Str = " " ; decrypt ( Str , 0 , N - 1 ) ;