dhyuti-n/xlcost-variable-roles huggingface dataset:
Javascript program:
function isvowel ( ch ) { return ( ch == ' ' ch == ' ' ch == ' ' ch == ' ' ch == ' ' ) ; } function isvalid ( s ) { let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { if ( ! isvowel ( s [ i ] ) ) return false ; } return true ; } function CountTotal ( s ) { let ans = 0 ; let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { let temp = " " ; for ( let j = i ; j < n ; j ++ ) { temp += s [ j ] ; if ( isvalid ( temp ) ) ans += 1 ; } } return ans ; } let s = " " ; document . write ( ( CountTotal ( s ) ) ) ;

Index/key variables: i, j
Accumulator variables: ans, i, j, temp
Iterator variables: i, j
Javascript program:
function isVowel ( c ) { return ( c == ' ' c == ' ' c == ' ' c == ' ' c == ' ' ) ; } function isValid ( s ) { let n = s . length ; if ( n == 1 ) return ( isVowel ( s [ 0 ] ) ) ; if ( isVowel ( s [ 0 ] ) == false ) return false ; for ( let i = 1 ; i < n ; i ++ ) { if ( s [ i ] == s [ i - 1 ] || ! isVowel ( s [ i ] ) ) return false ; } return true ; } function findMaxLen ( s ) { let maxLen = 0 ; let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { let temp = " " ; for ( let j = i ; j < n ; j ++ ) { temp = temp + s [ j ] ; if ( isValid ( temp ) ) maxLen = Math . max ( maxLen , ( j - i + 1 ) ) ; } } return maxLen ; } let Str = " " ; document . write ( findMaxLen ( Str ) ) ;

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function BalancedNumber ( s ) { let Leftsum = 0 ; let Rightsum = 0 ; for ( let i = 0 ; i < s . length / 2 ; i ++ ) { Leftsum += ( s [ i ] - ' ' ) ; Rightsum += ( s [ s . length - 1 - i ] - ' ' ) ; } if ( Leftsum == Rightsum ) document . write ( " " ) ; else document . write ( " " ) ; } let s = " " ; BalancedNumber ( s ) ;

Index/key variables: i
Accumulator variables: Leftsum, Rightsum, i
Iterator variables: i
Javascript program:
var mod = parseInt ( 1e9 + 7 ) ; function expo ( base , exponent ) { var ans = 1 ; while ( exponent != 0 ) { if ( ( exponent & 1 ) == 1 ) { ans = ans * base ; ans = ans % mod ; } base = base * base ; base %= mod ; exponent >>= 1 ; } return ans % mod ; } function findCount ( N ) { var ans = ( expo ( 26 , N ) - expo ( 5 , N ) - expo ( 21 , N ) ) % mod ; ans += mod ; ans %= mod ; return ans ; } var N = 3 ; document . write ( findCount ( N ) ) ;

Accumulator variables: ans
Javascript program:
function decompose ( S ) { let s = [ ] ; let N = S . length ; let ans = 0 ; let nix = Number . MAX_VALUE ; for ( let i = N - 1 ; i >= 0 ; i -- ) { if ( s . length == 0 ) { s . push ( S [ i ] ) ; nix = S [ i ] ; } else { if ( S [ i ] < s [ s . length - 1 ] ) { s . push ( S [ i ] ) ; nix = Math . min ( nix , S [ i ] ) ; } else { let val = S [ i ] ; while ( s . length != 0 && val >= s [ s . length - 1 ] ) { s . pop ( ) ; } nix = Math . min ( nix , S [ i ] ) ; s . push ( nix ) ; } } ans += s . length ; } return ans ; } let S = [ ] ; S . push ( 9 ) ; S . push ( 6 ) ; S . push ( 9 ) ; S . push ( 35 ) ; document . write ( decompose ( S ) ) ;

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Javascript program:
function maxSetBitCount ( s , k ) { var maxCount = 0 , n = s . length ; var count = 0 ; for ( var i = 0 ; i < k ; i ++ ) { if ( s [ i ] == ' ' ) count ++ ; } maxCount = count ; for ( var i = k ; i < n ; i ++ ) { if ( s [ i - k ] == ' ' ) count -- ; if ( s [ i ] == ' ' ) count ++ ; maxCount = Math . max ( maxCount , count ) ; } return maxCount ; } var s = " " ; var k = 3 ; document . write ( maxSetBitCount ( s , k ) ) ;

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Javascript program:
function minDel ( s1 , s2 ) { var i = s1 . length ; var j = s2 . length ; while ( i > 0 && j > 0 ) { if ( s1 [ i - 1 ] != s2 [ j - 1 ] ) { break ; } i -- ; j -- ; } return i + j ; } var s1 = " " , s2 = " " ; document . write ( minDel ( s1 , s2 ) ) ;

Accumulator variables: i, j
Javascript program:
function CountValidTriplet ( s , n ) { let count_a = 0 , count_b = 0 , count_c = 0 ; for ( let i = 0 ; i < n ; i ++ ) { if ( s [ i ] == ' ' ) count_a ++ ; if ( s [ i ] == ' ' ) count_b ++ ; if ( s [ i ] == ' ' ) count_c ++ ; } let Total_triplet = count_a * count_b * count_c ; for ( let i = 0 ; i < n ; i ++ ) { for ( let j = i + 1 ; j < n ; j ++ ) { if ( ( 2 * j - i ) < n && s [ j ] != s [ i ] && s [ j * 2 - i ] != s [ j ] && s [ 2 * j - i ] != s [ i ] ) Total_triplet -- ; } } document . write ( Total_triplet ) ; } let s = " " ; let n = s . length ; CountValidTriplet ( s , n ) ;

Index/key variables: i, j
Accumulator variables: Total_triplet, count_a, count_b, count_c, i, j
Iterator variables: i, j
Javascript program:
function checkWord ( board , word , index , row , col ) { if ( row < 0 col < 0 row >= board . length col >= board [ 0 ] . length ) return false ; if ( board [ row ] [ col ] !== word [ index ] ) return false ; else if ( index === word . length - 1 ) return true ; var temp = board [ row ] [ col ] ; board [ row ] [ col ] = " " ; if ( checkWord ( board , word , index + 1 , row + 1 , col ) || checkWord ( board , word , index + 1 , row - 1 , col ) || checkWord ( board , word , index + 1 , row , col + 1 ) || checkWord ( board , word , index + 1 , row , col - 1 ) ) { board [ row ] [ col ] = temp ; return true ; } board [ row ] [ col ] = temp ; return false ; } var board = [ [ " " , " " , " " , " " ] , [ " " , " " , " " , " " ] , [ " " , " " , " " , " " ] , ] ; var word = " " ; var f = 0 ; for ( var i = 0 ; i < board . length ; i ++ ) { for ( var j = 0 ; j < board [ 0 ] . length ; j ++ ) { if ( board [ i ] [ j ] === word [ 0 ] && checkWord ( board , word , 0 , i , j ) ) { document . write ( " " ) ; f = 1 ; } } if ( f === 1 ) { i = board . length + 1 ; } } if ( f === 0 ) { document . write ( " " ) ; }

Index/key variables: col, i, index, j, row
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function count ( N , X , subStr , index , n ) { if ( index == n ) return 0 ; let a = subStr + N [ index ] ; let b = 0 ; if ( parseInt ( a ) % X == 0 ) b = 1 ; let m1 = count ( N , X , a , index + 1 , n ) ; let m2 = b + count ( N , X , " " , index + 1 , n ) ; return Math . max ( m1 , m2 ) ; } let N = " " ; let K = 3 ; let l = N . length ; document . write ( count ( N , K , " " , 0 , l ) + " " ) ;

Index/key variables: index
Javascript program:
function checkSuffix ( A , B ) { var s1 = A . toString ( ) ; var s2 = B . toString ( ) ; var n1 = s1 . length ; var n2 = s2 . length ; if ( n1 < n2 ) { return false ; } for ( var i = 0 ; i < n2 ; i ++ ) { if ( s1 [ n1 - i - 1 ] != s2 [ n2 - i - 1 ] ) { return false ; } } return true ; } var A = 12345 , B = 45 ; var result = checkSuffix ( A , B ) ; if ( result ) { document . write ( " " ) ; } else { document . write ( " " ) ; }

Accumulator variables: i
Iterator variables: i
Javascript program:
function build_binary_str ( p , q , r ) { let ans = " " ; if ( q == 0 ) { if ( p != 0 && r != 0 ) { return " " ; } else { if ( p ) { ans = new Array ( p + 1 , ' ' ) ; } else { ans = String ( r + 1 , ' ' ) ; } } } else { for ( let i = 1 ; i <= q + 1 ; i ++ ) { if ( i % 2 == 0 ) { ans += ' ' ; } else { ans += ' ' ; } } ans = ans . substr ( 0 , 1 ) + Strings ( p , ' ' ) + ans . substr ( 1 ) ; ans = Strings ( r , ' ' ) + ans ; } return ans ; } function Strings ( p , c ) { let ans = " " ; for ( let i = 0 ; i < p ; i ++ ) ans += c ; return ans ; } let p = 1 , q = 2 , r = 2 ; document . write ( build_binary_str ( p , q , r ) ) ;

Accumulator variables: ans, i
Iterator variables: i
Javascript program:
function check ( s ) { var ok = true ; for ( var i = 0 ; i + 1 < s . length ; ++ i ) ok &= ( Math . abs ( s [ i ] - s [ i + 1 ] ) != 1 ) ; return ok ; } function monotonousString ( s ) { var odd = " " , even = " " ; for ( var i = 0 ; i < s . length ; ++ i ) { if ( s [ i ] % 2 == 0 ) odd += s [ i ] ; else even += s [ i ] ; } odd = odd . split ( ' ' ) . sort ( ) . join ( ' ' ) ; even = even . split ( ' ' ) . sort ( ) . join ( ' ' ) ; if ( check ( odd + even ) ) return " " ; else if ( check ( even + odd ) ) return " " ; return " " ; } var str = " " ; var ans ; ans = monotonousString ( str ) ; document . write ( ans ) ;

Index/key variables: i
Accumulator variables: even, odd, ok
Iterator variables: i
Boolean variables: ok
Javascript program:
function get_index ( ch ) { if ( ch == ' ' ) return 0 ; else if ( ch == ' ' ) return 1 ; else if ( ch == ' ' ) return 2 ; else if ( ch == ' ' ) return 3 ; else if ( ch == ' ' ) return 4 ; else return - 1 ; } function findMinLength ( s ) { let n = s . length ; let ans = n + 1 ; let start = 0 ; let count = new Array ( 5 ) ; for ( let i = 0 ; i < 5 ; i ++ ) { count [ i ] = 0 ; } for ( let x = 0 ; x < n ; x ++ ) { let idx = get_index ( s [ x ] ) ; if ( idx != - 1 ) { count [ idx ] ++ ; } let idx_start = get_index ( s [ start ] ) ; while ( idx_start == - 1 count [ idx_start ] > 1 ) { if ( idx_start != - 1 ) { count [ idx_start ] -- ; } start ++ ; if ( start < n ) idx_start = get_index ( s [ start ] ) ; } if ( count [ 0 ] > 0 && count [ 1 ] > 0 && count [ 2 ] > 0 && count [ 3 ] > 0 && count [ 4 ] > 0 ) { ans = Math . min ( ans , x - start + 1 ) ; } } if ( ans == n + 1 ) return - 1 ; return ans ; } let s = " " ; document . write ( findMinLength ( s ) ) ;

Index/key variables: i, idx, idx_start, start, x
Accumulator variables: i, start, x
Iterator variables: i, x
Javascript program:
function countStrings ( s ) { let cnt = 0 ; for ( let i = 1 ; s [ i ] ; i ++ ) { if ( s [ i ] == s [ i + 1 ] ) { cnt ++ ; } } return cnt ; } let str = " " ; document . write ( countStrings ( str ) ) ;

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Javascript program:
function checkValidString ( str ) { var freq = new Array ( 26 ) . fill ( 0 ) ; for ( var i = 0 ; i < str . length ; i ++ ) { freq [ str [ i ] . charCodeAt ( 0 ) - " " . charCodeAt ( 0 ) ] ++ ; } for ( var i = 0 ; i < 26 ; i ++ ) { if ( freq [ i ] !== 0 ) { if ( freq [ i ] !== i + 1 ) { return false ; } } } return true ; } var str = " " ; if ( checkValidString ( str ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function removeRepeating ( s1 , s2 ) { let s3 = s1 + " " + s2 + " " ; let words = " " ; let i = 0 ; let temp = s3 . split ( " " ) for ( let x = 0 ; x < temp . length ; x ++ ) { if ( temp [ x ] == ' ' ) { if ( ! s1 . includes ( words ) || ! s2 . includes ( words ) ) document . write ( words ) ; words = " " ; } else { words = words + temp [ x ] ; } } } let s1 = " " ; let s2 = " " ; removeRepeating ( s1 , s2 ) ;

Index/key variables: x
Accumulator variables: x
Iterator variables: x
Javascript program:
function isPrime ( n ) { if ( n <= 1 ) return false ; for ( let i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } function isPossibleSum ( N ) { if ( isPrime ( N ) && isPrime ( N - 2 ) ) { return true ; } else { return false ; } } function checkSemiprime ( num ) { let cnt = 0 ; for ( let i = 2 ; cnt < 2 && i * i <= num ; ++ i ) { while ( num % i == 0 ) { num = Math . floor ( num / i ) ; ++ cnt ; } } if ( num > 1 ) { ++ cnt ; } return cnt == 2 ; } function makeCypherString ( N ) { let semiPrime = " " ; let sumOfPrime = " " ; let str = ( N ) . toString ( ) ; if ( checkSemiprime ( N ) ) { for ( let i = 0 ; i < str . length ; i ++ ) { if ( i % 2 == 1 ) { semiPrime += str [ i ] ; } else { semiPrime += String . fromCharCode ( str [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) + 65 ) ; } } } if ( isPossibleSum ( N ) ) { for ( let i = 0 ; i < str . length ; i ++ ) { if ( i % 2 == 1 ) { sumOfPrime += String . fromCharCode ( str [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) + 65 ) ; } else { sumOfPrime += str [ i ] ; } } } if ( semiPrime + sumOfPrime == " " ) { document . write ( " " ) ; } else { document . write ( semiPrime + sumOfPrime ) ; } } let N = 1011243 ; makeCypherString ( N ) ;

Index/key variables: i
Accumulator variables: i, semiPrime, sumOfPrime
Iterator variables: i
Javascript program:
function rearrange ( str , K ) { var n = str . length ; var s = 0 , sum = 0 , count = 0 ; for ( var i = n - 1 ; i >= 0 ; i -- ) { var a = str . charAt ( i ) - ' ' ; sum += a * Math . pow ( 2 , s ) ; s ++ ; if ( sum != 0 && sum % K == 0 ) { count ++ ; sum = 0 ; s = 0 ; } } if ( sum != 0 ) document . write ( " " ) ; else document . write ( count ) ; } var str = " " ; var K = 5 ; rearrange ( str , K ) ;

Accumulator variables: count, i, s, sum
Iterator variables: i
Javascript program:
function findStr ( S ) { var n = S . length ; for ( var i = 0 ; i < n / 2 ; ++ i ) { if ( S [ i ] != ' ' ) { S [ i ] = ' ' ; return S . join ( " " ) ; ; } } S [ n - 1 ] = ' ' ; return n < 2 ? " " : S . join ( " " ) ; ; } var str = " " ; document . write ( findStr ( Array . from ( str ) ) + " " ) ; var str1 = " " ; document . write ( findStr ( Array . from ( str1 ) ) ) ;

Index/key variables: i
Iterator variables: i
Javascript program:
function kth_String ( n , k ) { for ( i = n - 2 ; i >= 0 ; i -- ) { if ( k <= ( n - i - 1 ) ) { for ( j = 0 ; j < n ; j ++ ) { if ( j == i j == n - k ) document . write ( ' ' ) ; else document . write ( ' ' ) ; } break ; } k -= ( n - i - 1 ) ; } } var n = 5 , k = 7 ; kth_String ( n , k ) ;

Accumulator variables: i, j, k
Iterator variables: i, j
Javascript program:
function convertString ( str1 , str2 , str3 ) { let freq = new Map ( ) ; for ( let i = 0 ; i < str3 . length ; i ++ ) { if ( freq . has ( str3 [ i ] ) ) freq . set ( str3 [ i ] , freq . get ( str3 [ i ] ) + 1 ) ; else freq . set ( str3 [ i ] , 1 ) ; } let ptr1 = 0 ; let ptr2 = 0 ; let flag = true ; while ( ptr1 < str1 . length && ptr2 < str2 . length ) { if ( str1 [ ptr1 ] == str2 [ ptr2 ] ) { ptr1 ++ ; ptr2 ++ ; } else { if ( freq . has ( str3 [ ptr2 ] ) ) if ( freq . get ( str3 [ ptr2 ] ) > 0 ) { freq . set ( str3 [ ptr2 ] , freq . get ( str3 [ ptr2 ] ) - 1 ) ; ptr2 ++ ; } else { flag = false ; break ; } } } if ( flag && ptr1 == str1 . length && ptr2 == str2 . length ) { document . write ( " " + " " ) ; } else { document . write ( " " + " " ) ; } } let str1 = " " ; let str2 = " " ; let str3 = " " ; convertString ( str1 , str2 , str3 ) ;

Index/key variables: i, ptr1, ptr2
Accumulator variables: i, ptr1, ptr2
Iterator variables: i
Boolean variables: flag
Javascript program:
let MOD = 26 ; function modulo_by_26 ( num ) { let res = 0 ; for ( let i = 0 ; i < num . length ; i ++ ) { res = ( ( res * 10 + num [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ) % MOD ) ; } return res ; } function decrypt_message ( s ) { let decrypted_str = " " ; let num_found_so_far = " " ; for ( let i = 0 ; i < s . length ; ++ i ) { if ( s [ i ] . charCodeAt ( 0 ) >= ' ' . charCodeAt ( 0 ) && s [ i ] . charCodeAt ( 0 ) <= ' ' . charCodeAt ( 0 ) ) { num_found_so_far += s [ i ] ; } else if ( num_found_so_far . length > 0 ) { decrypted_str += String . fromCharCode ( ' ' . charCodeAt ( 0 ) + modulo_by_26 ( num_found_so_far ) ) ; num_found_so_far = " " ; } } if ( num_found_so_far . length > 0 ) { decrypted_str += String . fromCharCode ( ' ' . charCodeAt ( 0 ) + modulo_by_26 ( num_found_so_far ) ) ; } return decrypted_str ; } let s = " " ; document . write ( decrypt_message ( s ) ) ;

Index/key variables: i
Accumulator variables: decrypted_str, i, num_found_so_far
Iterator variables: i
Javascript program:
function string_permutation ( n , str ) { let s = [ ] ; let result = ' ' ; n = n - 1 ; for ( let i = 1 ; i < str . length + 1 ; i ++ ) { s . push ( n % i ) ; n = Math . floor ( n / i ) ; } let len = str . length ; for ( let i = 0 ; i < len ; i ++ ) { let a = s [ s . length - 1 ] ; result += str [ a ] ; let j ; for ( j = a ; j < str . length ; j ++ ) str = str . substring ( 0 , j ) + str . charAt ( j + 1 ) + str . substring ( j + 1 ) ; str = str . substring ( 0 , j + 1 ) ; s . pop ( ) ; } document . write ( result , ' ' ) ; } let str = " " ; n = 11 ; string_permutation ( n , str ) ;

Index/key variables: a
Accumulator variables: i, j, result
Iterator variables: i, j
Javascript program:
function GeberateDefangIP ( str ) { var defangIP = " " ; str . split ( ' ' ) . forEach ( function ( letter ) { ( letter == ' ' ) ? defangIP += " " : defangIP += letter ; } ) return defangIP ; } var str = " " ; document . write ( GeberateDefangIP ( str ) ) ;

Accumulator variables: defangIP
Javascript program:
function generateTheString ( n ) { var ans = " " ; if ( n % 2 ) { for ( var i = 0 ; i < min ( n , 24 ) ; i ++ ) { ans += ( char ) ( ' ' + i ) ; } if ( n > 24 ) { for ( var i = 0 ; i < ( n - 24 ) ; i ++ ) ans += ' ' ; } } else { for ( var i = 0 ; i < Math . min ( n , 25 ) ; i ++ ) { ans += String . fromCharCode ( ' ' . charCodeAt ( 0 ) + i ) ; } if ( n > 25 ) { for ( var i = 0 ; i < ( n - 25 ) ; i ++ ) ans += ' ' ; } } return ans ; } var n = 34 ; document . write ( generateTheString ( n ) ) ;

Accumulator variables: ans, i
Iterator variables: i
Javascript program:
function moveAtEnd ( s , i , l ) { if ( i >= l ) return ; let curr = s [ i ] ; if ( curr != ' ' ) document . write ( curr ) ; moveAtEnd ( s , i + 1 , l ) ; if ( curr == ' ' ) document . write ( curr ) ; return ; } let s = " " ; let l = s . length ; moveAtEnd ( s , 0 , l ) ;

Index/key variables: i
Javascript program:
function string ( l , x , y ) { var p = 97 ; for ( var j = 0 ; j < l ; j ++ ) { var ans = String . fromCharCode ( p + ( j % y ) ) ; document . write ( ans ) ; } } var l = 6 ; var x = 5 ; var y = 3 ; string ( l , x , y ) ;

Accumulator variables: j
Iterator variables: j
Javascript program:
function finalCoordinates ( SX , SY , D ) { for ( let i = 0 ; i < D . length ; i ++ ) { if ( D [ i ] == ' ' ) SY += 1 ; else if ( D [ i ] == ' ' ) SY -= 1 ; else if ( D [ i ] == ' ' ) SX += 1 ; else SX -= 1 ; } let ans = ' ' + ( SX ) . toString ( ) + ' ' + ( SY ) . toString ( ) + ' ' ; document . write ( ans ) ; } let SX = 2 , SY = 2 ; let D = " " ; finalCoordinates ( SX , SY , D . split ( " " ) ) ;

Index/key variables: i
Accumulator variables: SX, SY, i
Iterator variables: i
Javascript program:
function upper_bound ( freq , f ) { let low = 0 , high = freq . length - 1 ; while ( low < high ) { let mid = Math . floor ( ( low + high ) / 2 ) ; if ( freq [ mid ] > f ) high = mid ; else low = mid + 1 ; } return ( freq [ low ] < f ) ? low ++ : low ; } function countMinFreq ( s ) { s = s . split ( ' ' ) . sort ( ) . join ( ' ' ) ; let x = 0 ; for ( let i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == s [ 0 ] ) x += 1 ; } return x ; } function countLessThan ( arr1 , arr2 ) { let freq = [ ] ; for ( let i = 0 ; i < arr2 . length ; i ++ ) { let f = countMinFreq ( arr2 [ i ] ) ; freq . push ( f ) ; } freq = freq . sort ( function ( a , b ) { return a - b } ) ; for ( let i = 0 ; i < arr1 . length ; i ++ ) { let f = countMinFreq ( arr1 [ i ] ) ; let it = upper_bound ( freq , f ) ; let cnt = freq . length - ( it ) ; document . write ( cnt , ' ' ) ; } } let arr1 , arr2 ; arr1 = [ " " , " " ] ; arr2 = [ " " , " " , " " , " " ] ; countLessThan ( arr1 , arr2 ) ;

Index/key variables: i, low, mid
Accumulator variables: i, low, x
Iterator variables: i
Javascript program:
function shortestPalindrome ( s ) { let abcd = Array . from ( { length : 26 } , ( _ , i ) => 0 ) ; for ( let i = 0 ; i < s . length ; i ++ ) abcd [ s [ i ] . charCodeAt ( ) - 97 ] = 1 ; for ( let i = 0 ; i < 26 ; i ++ ) { if ( abcd [ i ] == 1 ) { document . write ( String . fromCharCode ( i + 97 ) + " " ) ; } } } let s = " " ; shortestPalindrome ( s . split ( ' ' ) ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function removeDuplicates ( str ) { let n = str . length ; let res = " " ; for ( let i = 0 ; i < n ; i ++ ) { let j ; for ( j = i + 1 ; j < n ; j ++ ) if ( str [ i ] == str [ j ] ) break ; if ( j == n ) res = res + str [ i ] ; } return res ; } let str = " " ; document . write ( removeDuplicates ( str ) ) ;

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function removeDuplicates ( str ) { var n = str . length ; var s = new Set ( ) ; var res = " " ; for ( var i = n - 1 ; i >= 0 ; i -- ) { if ( ! s . has ( str [ i ] ) ) { res = res + str [ i ] ; s . add ( str [ i ] ) ; } } res = res . split ( ' ' ) . reverse ( ) . join ( ' ' ) ; return res ; } var str = " " ; document . write ( removeDuplicates ( str ) ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function contain ( L , U , M ) { let count = 0 ; for ( let j = L ; j < U ; j ++ ) { let num = new Set ( ) ; let str = String ( j ) ; num . add ( str ) ; if ( j % M == 0 && ! num . has ( String ( M ) ) ) { count += 1 ; } } document . write ( count - 2 ) ; } let L = 106 ; let U = 200 ; let M = 7 ; contain ( L , U , M ) ;

Accumulator variables: count, j
Iterator variables: j
Javascript program:
let max1 = 0 ; function MaxLength ( v , i , m ) { if ( i >= m ) { return m - 1 ; } for ( let k = 0 ; k < 26 ; k ++ ) { let c = String . fromCharCode ( ' ' . charCodeAt ( 0 ) + k ) ; let v1 = [ ] ; for ( let j = 0 ; j < v . length ; j ++ ) { if ( v [ j ] [ i ] == c ) { v1 . push ( v [ j ] ) ; } } if ( v1 . length >= 2 ) { max1 = Math . max ( max1 , MaxLength ( v1 , i + 1 , m ) ) ; } else { max1 = Math . max ( max1 , i - 1 ) ; } } return max1 ; } let s1 , s2 , s3 , s4 , s5 ; s1 = " " ; s2 = " " ; s3 = " " ; s4 = " " ; s5 = " " ; let v = [ ] ; v . push ( s1 ) ; v . push ( s2 ) ; v . push ( s3 ) ; v . push ( s4 ) ; v . push ( s5 ) ; let m = v [ 0 ] . length ; document . write ( MaxLength ( v , 0 , m ) + 1 + " " ) ;

Index/key variables: i, j
Accumulator variables: j, k
Iterator variables: j, k
Javascript program:
function findPeriodicString ( S ) { let l = 2 * S . length ; let count = 0 ; for ( let i = 0 ; i < S . length ; i ++ ) { if ( S [ i ] == ' ' ) count ++ ; } if ( count == S . length count == 0 ) document . write ( S + " " ) ; else { let arr = new Array ( l ) ; for ( let i = 0 ; i < l ; i += 2 ) { arr [ i ] = ' ' ; arr [ i + 1 ] = ' ' ; } for ( let i = 0 ; i < l ; i ++ ) document . write ( arr [ i ] ) ; document . write ( " " ) ; } } let S = " " ; findPeriodicString ( S ) ;

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Javascript program:
function group_formed ( S ) { let count = 1 ; for ( let i = 0 ; i < S . length - 1 ; i ++ ) { if ( S [ i ] != S [ i + 1 ] ) count += 1 ; } document . write ( count ) ; } let S = " " ; group_formed ( S ) ;

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Javascript program:
function value ( x ) { return ( x . charCodeAt ( ) - ' ' . charCodeAt ( ) ) ; } function maximumProduct ( str , n ) { let answer = " " , curr = " " ; let maxProduct = 0 , product = 1 ; for ( let i = 0 ; i < n ; i ++ ) { product *= ( 1 * value ( str [ i ] ) ) ; curr += str [ i ] ; if ( product >= maxProduct ) { maxProduct = product ; answer = curr ; } if ( product == 0 ) { product = 1 ; curr = " " ; } } return answer ; } let str = " " ; let n = str . length ; document . write ( maximumProduct ( str , n ) + " " ) ;

Index/key variables: i
Accumulator variables: curr, i, product
Iterator variables: i
Javascript program:
function solve ( a , b ) { var l = a . length ; var min = 0 , max = 0 ; for ( var i = 0 ; i < l ; i ++ ) { if ( a [ i ] == ' ' b [ i ] == ' ' a [ i ] != b [ i ] ) max ++ ; if ( a [ i ] != ' ' && b [ i ] != ' ' && a [ i ] != b [ i ] ) min ++ ; } document . write ( min + max ) ; } var s1 = " " , s2 = " " ; solve ( s1 , s2 ) ;

Index/key variables: i
Accumulator variables: i, max, min
Iterator variables: i
Javascript program:
function noOfDeletions ( str , k ) { var ans = 0 , cnt = 0 , pos = 0 ; while ( pos < str . length && str [ pos ] != k ) { pos ++ ; } var i = pos ; while ( i < str . length ) { while ( i < str . length && str [ i ] == k ) { i = i + 1 ; } ans = ans + cnt ; cnt = 0 ; while ( i < str . length && str [ i ] != k ) { i = i + 1 ; cnt = cnt + 1 ; } } return ans ; } var str1 = " " ; var k1 = ' ' ; document . write ( noOfDeletions ( str1 , k1 ) + " " ) ; var str2 = " " ; var k2 = ' ' ; document . write ( noOfDeletions ( str2 , k2 ) ) ;

Index/key variables: i, pos
Accumulator variables: pos