dhyuti-n/xlcost-variable-roles huggingface dataset:
Javascript program:
function find ( s ) { let max = 0 , i , j = 0 , countk = 0 , countr = 0 ; let table = new Array ( s . length ) ; for ( let i = 0 ; i < s . length ; i ++ ) { table [ i ] = new Array ( 2 ) ; } for ( i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == ' ' ) countr ++ ; else table [ j ++ ] [ 0 ] = countr ; } j -- ; for ( i = s . length - 1 ; i >= 0 ; i -- ) { if ( s [ i ] == ' ' ) { countk ++ ; table [ j -- ] [ 1 ] = countk ; } if ( Math . min ( table [ j + 1 ] [ 0 ] , table [ j + 1 ] [ 1 ] ) > max ) max = Math . min ( table [ j + 1 ] [ 0 ] , table [ j + 1 ] [ 1 ] ) ; } return max ; } let s = " " ; let n = find ( s ) ; document . write ( n ) ;

Index/key variables: i
Accumulator variables: countk, countr, i, j
Iterator variables: i
Javascript program:
let MAX_CHAR = 26 ; function frequency ( fre , s , n ) { for ( let i = 0 ; i < n ; i ++ ) { let str = s [ i ] ; for ( let j = 0 ; j < str . length ; j ++ ) fre [ i ] [ str [ j ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; } } function LongestSequence ( fre , n ) { for ( let i = 24 ; i >= 0 ; i -- ) { let mi = fre [ 0 ] [ i ] ; for ( let j = 1 ; j < n ; j ++ ) mi = Math . min ( fre [ j ] [ i ] , mi ) ; while ( mi -- != 0 ) document . write ( String . fromCharCode ( ' ' . charCodeAt ( 0 ) + i ) ) ; } } let s = [ " " , " " , " " ] ; let n = s . length ; let fre = new Array ( n ) ; for ( let i = 0 ; i < n ; i ++ ) { fre [ i ] = new Array ( 26 ) ; for ( let j = 0 ; j < 26 ; j ++ ) fre [ i ] [ j ] = 0 ; } frequency ( fre , s , n ) ; LongestSequence ( fre , n ) ;

Index/key variables: i, j
Accumulator variables: i, j, mi
Iterator variables: i, j
Javascript program:
function arePermutation ( str1 , str2 ) { let n1 = str1 . length ; let n2 = str2 . length ; if ( n1 != n2 ) return false ; let ch1 = str1 . split ( ' ' ) ; let ch2 = str2 . split ( ' ' ) ; ch1 . sort ( ) ; ch2 . sort ( ) ; for ( let i = 0 ; i < n1 ; i ++ ) if ( ch1 [ i ] != ch2 [ i ] ) return false ; return true ; } let str1 = " " ; let str2 = " " ; if ( arePermutation ( str1 , str2 ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function arePermutation ( str1 , str2 ) { let count = new Array ( NO_OF_CHARS ) ; let i ; for ( i = 0 ; str1 [ i ] && str2 [ i ] ; i ++ ) { count [ str1 [ i ] ] ++ ; count [ str2 [ i ] ] -- ; } if ( str1 [ i ] str2 [ i ] ) return false ; for ( i = 0 ; i < NO_OF_CHARS ; i ++ ) if ( count [ i ] != 0 ) return false ; return true ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function powerOfJump ( s ) { let count = 1 ; let max_so_far = Number . MIN_VALUE ; let ch = s [ s . length - 1 ] ; for ( let i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == ch ) { if ( count > max_so_far ) { max_so_far = count ; } count = 1 ; } else count ++ ; } return max_so_far ; } let st = " " ; document . write ( powerOfJump ( st ) ) ;

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Javascript program:
function findLongestSub ( bin ) { let n = bin . length , i ; let sum = 0 ; let prevSum = new Map ( ) ; let maxlen = 0 ; let currlen ; for ( i = 0 ; i < n ; i ++ ) { if ( bin [ i ] == ' ' ) sum ++ ; else sum -- ; if ( sum > 0 ) { maxlen = i + 1 ; } else if ( sum <= 0 ) { if ( prevSum . has ( sum - 1 ) ) { currlen = i - ( prevSum . get ( sum - 1 ) == null ? 1 : prevSum . get ( sum - 1 ) ) ; maxlen = Math . max ( maxlen , currlen ) ; } } if ( ! prevSum . has ( sum ) ) prevSum . set ( sum , i ) ; } return maxlen ; } let bin = " " ; document . write ( findLongestSub ( bin ) ) ;

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Javascript program:
function averageValue ( s ) { let sum_char = 0 ; for ( let i = 0 ; i < s . length ; i ++ ) { sum_char += ( s [ i ] ) . charCodeAt ( 0 ) ; } return Math . floor ( sum_char / s . length ) ; } let s = " " ; document . write ( averageValue ( s ) ) ;

Index/key variables: i
Accumulator variables: i, sum_char
Iterator variables: i
Javascript program:
function check ( s , l ) { let freq = new Array ( 26 ) . fill ( 0 ) ; for ( let i = 0 ; i < l ; i ++ ) { freq [ s [ i ] . charCodeAt ( ) - ' ' . charCodeAt ( ) ] ++ ; } for ( let i = 0 ; i < 26 ; i ++ ) { if ( freq [ i ] >= 2 ) return true ; } return false ; } let s = " " ; let l = s . length ; if ( check ( s , l ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function isPalindrome ( str , l , r ) { while ( l < r ) { if ( str [ l ] != str [ r ] ) return false ; l ++ ; r -- ; } return true ; } function CyclicShifts ( str ) { var n = str . length ; var left = 0 ; var right = n - 1 ; str = str + str ; var cnt = 0 ; while ( right < 2 * n - 1 ) { if ( isPalindrome ( str , left , right ) ) break ; cnt ++ ; left ++ ; right ++ ; } return cnt ; } var str = " " ; document . write ( CyclicShifts ( str ) ) ;

Index/key variables: l, r
Accumulator variables: cnt, l, left, r, right
Javascript program:
function printString ( n , str ) { var str2 = " " ; var extraChar = n % 26 ; if ( extraChar >= 1 ) { for ( var i = 26 - ( extraChar + 1 ) ; i <= 25 ; i ++ ) str2 += str [ i ] ; } var countOfStr = parseInt ( n / 26 ) ; for ( var i = 1 ; i <= countOfStr ; i ++ ) { for ( var j = 0 ; j < 26 ; j ++ ) str2 += str [ j ] ; } return str2 ; } var n = 30 ; var str = " " ; document . write ( printString ( n , str ) ) ;

Index/key variables: i, j
Accumulator variables: i, j, str2
Iterator variables: i, j
Javascript program:
function commonPrefixUtil ( str1 , str2 ) { let result = " " ; let n1 = str1 . length , n2 = str2 . length ; for ( let i = 0 , j = 0 ; i <= n1 - 1 && j <= n2 - 1 ; i ++ , j ++ ) { if ( str1 [ i ] != str2 [ j ] ) { break ; } result += str1 [ i ] ; } return ( result ) ; } function commonPrefix ( arr , n ) { arr . sort ( ) ; document . write ( commonPrefixUtil ( arr [ 0 ] , arr [ n - 1 ] ) + " " ) ; } let arr = [ " " , " " , " " , " " ] ; let n = arr . length ; commonPrefix ( arr , n ) ;

Index/key variables: i, j
Accumulator variables: i, j, result
Iterator variables: i
Javascript program:
function multiply ( num1 , num2 ) { let n1 = num1 . length ; let n2 = num2 . length ; if ( n1 == 0 n2 == 0 ) return " " ; let result = new Array ( n1 + n2 ) ; for ( let i = 0 ; i < result . length ; i ++ ) { result [ i ] = 0 ; } let i_n1 = 0 ; let i_n2 = 0 ; for ( let i = n1 - 1 ; i >= 0 ; i -- ) { let carry = 0 ; let n_1 = num1 [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ; i_n2 = 0 ; for ( let j = n2 - 1 ; j >= 0 ; j -- ) { let n_2 = num2 [ j ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ; let sum = n_1 * n_2 + result [ i_n1 + i_n2 ] + carry ; carry = Math . floor ( sum / 10 ) ; result [ i_n1 + i_n2 ] = sum % 10 ; i_n2 ++ ; } if ( carry > 0 ) result [ i_n1 + i_n2 ] += carry ; i_n1 ++ ; } let i = result . length - 1 ; while ( i >= 0 && result [ i ] == 0 ) i -- ; if ( i == - 1 ) return " " ; let s = " " ; while ( i >= 0 ) s += ( result [ i -- ] ) . toString ( ) ; return s ; } let str1 = " " ; document . write ( multiply ( str1 , str1 ) ) ;

Index/key variables: i, j
Accumulator variables: i, i_n1, i_n2, j, s
Iterator variables: i, j
Javascript program:
function countDigits ( st , n ) { if ( n > 0 ) { let cnt = 1 , i ; let st2 = " " ; for ( i = 1 ; i < st . length ; i ++ ) { if ( st [ i ] == st [ i - 1 ] ) cnt ++ ; else { st2 += String . fromCharCode ( ' ' . charCodeAt ( ) + cnt ) ; st2 += st [ i - 1 ] ; cnt = 1 ; } } st2 += String . fromCharCode ( ' ' . charCodeAt ( ) + cnt ) ; st2 += st [ i - 1 ] ; countDigits ( st2 , -- n ) ; } else document . write ( st ) ; } let num = " " ; let n = 3 ; countDigits ( num , n ) ;

Index/key variables: i
Accumulator variables: cnt, i, st2
Iterator variables: i
Javascript program:
function match_words ( dictionary , sentence , n , m ) { let mp = new Map ( ) ; for ( let i = 0 ; i < n ; i ++ ) { if ( mp . has ( dictionary [ i ] ) ) { mp . set ( dictionary [ i ] , mp . get ( dictionary [ i ] ) + 1 ) ; } else { mp . set ( dictionary [ i ] , 1 ) ; } } for ( let i = 0 ; i < m ; i ++ ) { if ( mp . has ( sentence [ i ] ) ) mp . set ( sentence [ i ] , mp . get ( sentence [ i ] ) - 1 ) ; else return false ; } return true ; } let dictionary = [ " " , " " , " " , " " , " " , " " , " " , " " , " " ] ; let n = dictionary . length ; let sentence = [ " " , " " , " " , " " , " " , " " , " " ] ; let m = sentence . length ; if ( match_words ( dictionary , sentence , n , m ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function printNum ( s ) { let i = 0 , j = 0 , val = 0 ; let hm = new Map ( ) ; val = ( s [ 0 ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ) * 100 + ( s [ 1 ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ) * 10 + ( s [ 2 ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ) ; hm . set ( val , 1 ) ; for ( i = 3 ; i < s . length ; i ++ ) { val = ( val % 100 ) * 10 + s [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ; if ( hm . has ( val ) ) { hm . set ( val , hm . get ( val ) + 1 ) ; } else { hm . set ( val , 1 ) ; } } for ( let [ Key , Value ] of hm . entries ( ) ) { let key = Key ; let value = Value ; if ( value > 1 ) document . write ( key + " " + value + " " ) ; } } let input = " " ; printNum ( input ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function hasAllcodes ( s , k ) { let us = new Set ( ) ; for ( let i = 0 ; i + k <= s . length ; i ++ ) { us . add ( s . substring ( i , i + k ) ) ; } return ( us . size == ( 1 << k ) ) ; } let s = " " ; let k = 2 ; if ( hasAllcodes ( s , k ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }

Accumulator variables: i
Iterator variables: i
Javascript program:
function addBinaryUtil ( a , b ) { var result = " " ; var s = 0 ; var i = a . length - 1 , j = b . length - 1 ; while ( i >= 0 j >= 0 s == 1 ) { s += ( ( i >= 0 ) ? a . charCodeAt ( i ) - ' ' . charCodeAt ( 0 ) : 0 ) ; s += ( ( j >= 0 ) ? b . charCodeAt ( j ) - ' ' . charCodeAt ( 0 ) : 0 ) ; result = String . fromCharCode ( ( s % 2 == 1 ? 1 : 0 ) + ' ' . charCodeAt ( 0 ) ) + result ; s = parseInt ( s / 2 ) ; i -- ; j -- ; } return result ; } function addBinary ( arr , n ) { var result = " " ; for ( var i = 0 ; i < n ; i ++ ) result = addBinaryUtil ( result , arr [ i ] ) ; return result ; } var arr = [ " " , " " , " " ] ; var n = arr . length ; document . write ( addBinary ( arr , n ) ) ;

Index/key variables: i
Accumulator variables: i, j, s
Iterator variables: i
Javascript program:
function reverse ( str , start , end ) { let temp ; while ( start <= end ) { temp = str [ start ] ; str [ start ] = str [ end ] ; str [ end ] = temp ; start ++ ; end -- ; } } function reverseletter ( str , start , end ) { let wstart , wend ; for ( wstart = wend = start ; wend < end ; wend ++ ) { if ( str [ wend ] == ' ' ) { continue ; } while ( wend <= end && str [ wend ] != ' ' ) { wend ++ ; } wend -- ; reverse ( str , wstart , wend ) ; } } let str = " " . split ( " " ) ; reverseletter ( str , 0 , str . length - 1 ) ; document . write ( ( str ) . join ( " " ) ) ;

Index/key variables: end, start, wend
Accumulator variables: end, start, wend
Iterator variables: wstart
Javascript program:
function minimumFlip ( s , x , y ) { s = s + s ; var isOpposite = false ; if ( x > y ) { swap ( x , y ) ; isOpposite = true ; } var valClockwise = 0 ; var cur = s [ x ] ; for ( var i = x ; i <= y ; i ++ ) { if ( s [ i ] != cur ) { cur = s [ i ] ; valClockwise ++ ; } } var valAnticlockwise = 0 ; cur = s [ y ] ; x += s . length ; for ( var i = y ; i <= x ; i ++ ) { if ( s [ i ] != cur ) { cur = s [ i ] ; valAnticlockwise ++ ; } } if ( valClockwise <= valAnticlockwise ) { if ( ! isOpposite ) document . write ( " " + valClockwise + " " ) ; else document . write ( " " + valAnticlockwise + " " ) ; } else { if ( ! isOpposite ) document . write ( " " + valAnticlockwise + " " ) ; else document . write ( " " + valClockwise + " " ) ; } } var x = 0 , y = 8 ; var s = " " ; minimumFlip ( s , x , y ) ;

Index/key variables: i, x, y
Accumulator variables: i, valAnticlockwise, valClockwise, x
Iterator variables: i
Boolean variables: isOpposite
Javascript program:
function prefix ( k , n ) { let a = 0 , b = 0 , count = 0 ; let i = 0 ; let len = k . length ; for ( i = 0 ; i < len ; i ++ ) { if ( k [ i ] == ' ' ) a ++ ; if ( k [ i ] == ' ' ) b ++ ; if ( a > b ) { count ++ ; } } if ( count == 0 n == 1 ) { document . write ( count + " " ) ; return 0 ; } if ( count == len a - b == 0 ) { document . write ( ( count * n ) + " " ) ; return 0 ; } let n2 = n - 1 , count2 = 0 ; while ( n2 != 0 ) { for ( i = 0 ; i < len ; i ++ ) { if ( k [ i ] == ' ' ) a ++ ; if ( k [ i ] == ' ' ) b ++ ; if ( a > b ) { count2 ++ ; } } count += count2 ; n2 -- ; if ( count2 == 0 ) break ; if ( count2 == len ) { count += ( n2 * count2 ) ; break ; } count2 = 0 ; } return count ; } let S = " " ; let N = 2 ; document . write ( prefix ( S , N ) + " " ) ; S = " " ; N = 3 ; document . write ( prefix ( S , N ) + " " ) ;

Index/key variables: i
Accumulator variables: a, b, count, count2, i, n2
Iterator variables: i
Javascript program:
let N = 20 ; function countPair ( str , n ) { let cnt = new Array ( 1 << 10 ) ; for ( let i = 0 ; i < cnt . length ; i ++ ) { cnt [ i ] = 0 ; } for ( let i = 0 ; i < n ; i ++ ) { let mask = 0 ; for ( let j = 0 ; j < str [ i ] . length ; ++ j ) mask |= ( 1 << ( str [ i ] [ j ] - ' ' ) ) ; cnt [ mask ] ++ ; } let ans = 0 ; for ( let m1 = 0 ; m1 <= 1023 ; m1 ++ ) for ( let m2 = 0 ; m2 <= 1023 ; m2 ++ ) if ( ( m1 m2 ) == 1023 ) { ans += ( ( m1 == m2 ) ? ( cnt [ m1 ] * ( cnt [ m1 ] - 1 ) ) : ( cnt [ m1 ] * cnt [ m2 ] ) ) ; } return Math . floor ( ans / 2 ) ; } let n = 5 ; let st = [ " " , " " , " " , " " , " " ] ; document . write ( countPair ( st , n ) )

Index/key variables: i, j, m1, m2, mask
Accumulator variables: ans, i, m1, m2, mask
Iterator variables: i, j, m1, m2
Javascript program:
var mod = 1000000007 var max = 1001 var nCr = Array . from ( Array ( 1003 ) , ( ) => Array ( 1003 ) ) ; function preComputeCoeff ( ) { for ( var i = 0 ; i < max ; i ++ ) { for ( var j = 0 ; j <= i ; j ++ ) { if ( j == 0 j == i ) nCr [ i ] [ j ] = 1 ; else nCr [ i ] [ j ] = ( nCr [ i - 1 ] [ j - 1 ] + nCr [ i - 1 ] [ j ] ) % mod ; } } } function computeStringCount ( N ) { var n = N / 2 ; var ans = 0 ; for ( var i = 2 ; i <= n ; i += 2 ) ans = ( ans + ( ( nCr [ n ] [ i ] * nCr [ n ] [ i / 2 ] ) % mod ) ) % mod ; return ans ; } preComputeCoeff ( ) ; var N = 3 ; document . write ( computeStringCount ( N ) ) ;

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
var MAX = 100 ; function countSubsequence ( s , n ) { var cntG = 0 , cntF = 0 , result = 0 , C = 0 ; for ( var i = 0 ; i < n ; i ++ ) { switch ( s [ i ] ) { case ' ' : cntG ++ ; result += C ; break ; case ' ' : cntF ++ ; C += cntG ; break ; default : continue ; } } document . write ( result ) ; } var s = " " ; var n = ( s . length ) ; countSubsequence ( s , n ) ;

Index/key variables: i
Accumulator variables: C, cntF, cntG, i, result
Iterator variables: i
Javascript program:
function LexicographicalMaxString ( str ) { var mx = " " ; for ( var i = 0 ; i < str . length ; ++ i ) { if ( mx . localeCompare ( str . substring ( i ) ) <= 0 ) { mx = str . substring ( i ) ; } } return mx ; } var str = " " ; document . write ( LexicographicalMaxString ( str ) ) ;

Iterator variables: i
Javascript program:
function LexicographicalMaxString ( str ) { let maxchar = ' ' ; let index = [ ] ; for ( let i = 0 ; i < str . length ; i ++ ) { if ( str [ i ] >= maxchar ) { maxchar = str [ i ] ; index . push ( i ) ; } } let maxstring = " " ; for ( let i = 0 ; i < index . length ; i ++ ) { if ( str . substring ( index [ i ] , str . length ) > maxstring ) { maxstring = str . substring ( index [ i ] , str . length ) ; } } return maxstring ; } let str = " " ; document . write ( LexicographicalMaxString ( str ) ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function checkPalin ( word ) { let n = word . length ; word = word . toLowerCase ( ) ; for ( let i = 0 ; i < n ; i ++ , n -- ) if ( word [ i ] != word [ n - 1 ] ) return false ; return true ; } function longestPalin ( str ) { str = str + " " ; let longestword = " " , word = " " ; let length , length1 = 0 ; for ( let i = 0 ; i < str . length ; i ++ ) { let ch = str [ i ] ; if ( ch != ' ' ) word = word + ch ; else { length = word . length ; if ( checkPalin ( word ) && length > length1 ) { length1 = length ; longestword = word ; } word = " " ; } } return longestword ; } let s = " " + " " ; if ( longestPalin ( s ) == " " ) document . write ( " " + " " ) ; else document . write ( longestPalin ( s ) ) ;

Index/key variables: i
Accumulator variables: i, n
Iterator variables: i
Javascript program:
function isCommonBase ( base , s1 , s2 ) { for ( let j = 0 ; j < s1 . length ; ++ j ) { if ( base [ j % base . length ] != s1 [ j ] ) { return false ; } } for ( let j = 0 ; j < s2 . length ; ++ j ) { if ( base [ j % base . length ] != s2 [ j ] ) { return false ; } } return true ; } function countCommonBases ( s1 , s2 ) { let n1 = s1 . length , n2 = s2 . length ; let count = 0 ; for ( let i = 1 ; i <= Math . min ( n1 , n2 ) ; i ++ ) { let base = s1 . substring ( 0 , i ) ; if ( isCommonBase ( base , s1 , s2 ) ) { count ++ ; } } return count ; } let s1 = " " ; let s2 = " " ; document . write ( countCommonBases ( s1 , s2 ) ) ;

Index/key variables: j
Accumulator variables: count, i
Iterator variables: i, j
Javascript program:
function isPerfectSquareString ( str ) { var sum = 0 ; var len = str . length ; for ( var i = 0 ; i < len ; i ++ ) sum += str . charCodeAt ( i ) ; var squareRoot = Math . sqrt ( sum ) ; return squareRoot - Math . floor ( squareRoot ) == 0 ; } var str = " " ; if ( isPerfectSquareString ( str ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: i, sum
Iterator variables: i
Javascript program:
function find_sub ( s , k ) { let len = s . length ; let lp = 0 , rp = 0 ; let ans = 0 ; let hash_char = new Array ( 26 ) ; for ( let i = 0 ; i < hash_char . length ; i ++ ) { hash_char [ i ] = 0 ; } for ( ; rp < len ; rp ++ ) { hash_char [ s [ rp ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; while ( hash_char [ s [ rp ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] > k ) { hash_char [ s [ lp ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] -- ; lp ++ ; } ans += rp - lp + 1 ; } return ans ; } let S = " " ; let k = 2 ; document . write ( find_sub ( S , k ) ) ;

Index/key variables: i, lp, rp
Accumulator variables: ans, i, lp, rp
Iterator variables: i
Javascript program:
function printNumbers ( n , d ) { let st = " " + d ; let ch = st [ 0 ] ; for ( let i = 0 ; i < n ; i ++ ) { st = " " ; st = st + i ; if ( i == d || st . indexOf ( ch ) >= 0 ) document . write ( i + " " ) ; } } let n = 100 , d = 5 ; printNumbers ( n , d ) ;

Accumulator variables: i
Iterator variables: i
Javascript program:
function transformString ( ) { var ch = ' ' ; if ( s . length < 26 ) return false ; for ( var i = 0 ; i < s . length ; i ++ ) { if ( ch . charCodeAt ( 0 ) > 122 ) break ; if ( s [ i ] . charCodeAt ( 0 ) <= ch . charCodeAt ( 0 ) ) { s [ i ] = ch ; ch = String . fromCharCode ( ch . charCodeAt ( 0 ) + 1 ) ; } } s = s . join ( ' ' ) if ( ch . charCodeAt ( 0 ) <= ' ' . charCodeAt ( 0 ) ) return false ; return true ; } var s = " " . split ( ' ' ) ; if ( transformString ( s ) ) document . write ( s ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function isPanDigital ( s ) { let digits = new Array ( 10 ) . fill ( false ) ; for ( let i = 0 ; i < s . length ; i ++ ) digits [ s [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] = true ; for ( let i = 0 ; i <= 9 ; i ++ ) if ( digits [ i ] == false ) return false ; return true ; } function countPandigitalPairs ( v ) { let pairs = 0 ; for ( let i = 0 ; i < v . length ; i ++ ) { for ( let j = i + 1 ; j < v . length ; j ++ ) { if ( isPanDigital ( v [ i ] + v [ j ] ) ) { pairs ++ ; } } } return pairs ; } let v = [ " " , " " , " " , " " ] ; document . write ( countPandigitalPairs ( v ) ) ;

Index/key variables: i, j
Accumulator variables: i, j, pairs
Iterator variables: i, j
Javascript program:
const pandigitalMask = ( ( 1 << 10 ) - 1 ) ; function computeMaskFrequencies ( v , freq ) { for ( let i = 0 ; i < v . length ; i ++ ) { let mask = 0 ; let digits = new Set ( ) ; for ( let j = 0 ; j < v [ i ] . length ; j ++ ) digits . add ( ( v [ i ] [ j ] ) . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ) ; for ( let it of digits ) { let digit = it ; mask += ( 1 << digit ) ; } if ( freq . has ( mask ) ) { freq . set ( mask , freq . get ( mask ) + 1 ) } else { freq . set ( mask , 1 ) } } } function pandigitalConcatenations ( freq ) { let ans = 0 ; for ( let i = 1 ; i <= 1023 ; i ++ ) { for ( let j = 1 ; j <= 1023 ; j ++ ) { if ( ( i j ) == pandigitalMask && freq . has ( i ) && freq . has ( j ) ) { if ( i == j ) ans += ( freq . get ( i ) * ( freq . get ( i ) - 1 ) ) ; else ans += ( freq . get ( i ) * freq . get ( j ) ) ; } } } return Math . floor ( ans / 2 ) ; } function countPandigitalPairs ( v ) { let freq = new Map ( ) ; computeMaskFrequencies ( v , freq ) ; return pandigitalConcatenations ( freq ) ; } let v = [ " " , " " , " " , " " ] ; document . write ( countPandigitalPairs ( v ) + " " ) ;

Index/key variables: i, j
Accumulator variables: ans, i, j, mask
Iterator variables: i, it, j
Javascript program:
var MAX = 256 ; function printPalindromePos ( str ) { var pos = Array . from ( Array ( MAX ) , ( ) => Array ( ) ) ; var n = str . length ; for ( var i = 0 ; i < n ; i ++ ) pos [ str [ i ] . charCodeAt ( 0 ) ] . push ( i + 1 ) ; var oddCount = 0 ; var oddChar ; for ( var i = 0 ; i < MAX ; i ++ ) { if ( pos [ i ] . length % 2 != 0 ) { oddCount ++ ; oddChar = i ; } } if ( oddCount > 1 ) document . write ( " " ) ; for ( var i = 0 ; i < MAX ; i ++ ) { var mid = pos [ i ] . length / 2 ; for ( var j = 0 ; j < mid ; j ++ ) document . write ( pos [ i ] [ j ] + " " ) ; } if ( oddCount > 0 ) { var last = pos [ oddChar ] . length - 1 ; document . write ( pos [ oddChar ] [ last ] + " " ) ; pos [ oddChar ] . pop ( ) ; } for ( var i = MAX - 1 ; i >= 0 ; i -- ) { var count = pos [ i ] . length ; for ( var j = count / 2 ; j < count ; j ++ ) document . write ( pos [ i ] [ j ] + " " ) ; } } var s = " " ; printPalindromePos ( s ) ;

Index/key variables: i, j, last, oddChar
Accumulator variables: i, j, oddCount
Iterator variables: i, j
Javascript program:
var MAX_CHAR = 26 ; function minChanges ( str ) { var n = str . length ; if ( n > MAX_CHAR ) return - 1 ; var dist_count = 0 ; var count = Array . from ( { length : MAX_CHAR } , ( _ , i ) => 0 ) ; for ( var i = 0 ; i < MAX_CHAR ; i ++ ) count [ i ] = 0 ; for ( var i = 0 ; i < n ; i ++ ) { if ( count [ str . charAt ( i ) . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] == 0 ) dist_count ++ ; count [ str . charAt ( i ) . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; } return ( n - dist_count ) ; } var str = " " ; document . write ( minChanges ( str ) ) ;

Index/key variables: i
Accumulator variables: dist_count, i
Iterator variables: i