dhyuti-n/xlcost-variable-roles huggingface dataset:
Javascript program:
function val ( c ) { if ( c >= ' ' && c <= ' ' ) return c - ' ' ; else return c - ' ' + 10 ; } function toDeci ( str , base ) { let len = str . length ; let power = 1 ; let num = 0 ; let i ; for ( i = len - 1 ; i >= 0 ; i -- ) { if ( val ( str [ i ] ) >= base ) { return - 1 ; } num += val ( str [ i ] ) * power ; power = power * base ; } return num ; } function checkCorrespond ( str , x ) { let counter = 0 ; let n = str . length ; for ( let i = 0 ; i < n ; i ++ ) { for ( let j = 2 ; j <= 36 ; j ++ ) { if ( toDeci ( str [ i ] , j ) == x ) { counter ++ ; break ; } } } if ( counter == n ) document . write ( " " + " " ) ; else document . write ( " " + " " ) ; } let x = 16 ; let str = [ " " , " " , " " ] ; checkCorrespond ( str , x ) ;

Index/key variables: i
Accumulator variables: counter, i, j, num
Iterator variables: i, j
Javascript program:
function LexicoLesserStrings ( s ) { var count = 0 ; var len ; len = s . length ; for ( var i = 0 ; i < len ; i ++ ) { count += ( s [ i ] . charCodeAt ( 0 ) - " " . charCodeAt ( 0 ) ) * Math . pow ( 26 , len - i - 1 ) ; } return count ; } function countString ( S1 , S2 ) { var countS1 , countS2 , totalString ; countS1 = LexicoLesserStrings ( S1 ) ; countS2 = LexicoLesserStrings ( S2 ) ; totalString = countS2 - countS1 - 1 ; return totalString < 0 ? 0 : totalString ; } var S1 , S2 ; S1 = " " ; S2 = " " ; document . write ( countString ( S1 , S2 ) ) ;

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Javascript program:
function isVowel ( x ) { x = ( x . toLowerCase ( ) ) ; return ( x == ' ' x == ' ' x == ' ' x == ' ' x == ' ' ) ; } function longestVowelSubsequence ( str ) { var answer = " " ; var n = str . length ; for ( var i = 0 ; i < n ; i ++ ) { if ( isVowel ( str [ i ] ) ) { answer += str [ i ] ; } } return answer ; } var str = " " ; document . write ( longestVowelSubsequence ( str ) ) ;

Index/key variables: i
Accumulator variables: answer, i
Iterator variables: i
Javascript program:
function findMaxFrequency ( s ) { var arr = Array ( 26 ) . fill ( 0 ) ; for ( var i = 0 ; i < s . length ; i ++ ) arr [ s [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; var hash = new Map ( ) ; for ( var i = 0 ; i < 26 ; i ++ ) if ( arr [ i ] != 0 ) { if ( hash . has ( arr [ i ] ) ) hash . set ( arr [ i ] , hash . get ( arr [ i ] ) + 1 ) else hash . set ( arr [ i ] , 1 ) } var max_count = 0 , res = - 1 ; hash . forEach ( ( value , key ) => { if ( max_count < value ) { res = key ; max_count = value ; } } ) ; document . write ( " " + res + " " + max_count + " " ) ; } var s = " " ; findMaxFrequency ( s ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function xoring ( a , b , n ) { let ans = " " ; for ( let i = 0 ; i < n ; i ++ ) { if ( a [ i ] == b [ i ] ) ans += " " ; else ans += " " ; } return ans ; } let a = " " ; let b = " " ; let n = a . length ; let c = xoring ( a , b , n ) ; document . write ( c ) ;

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Javascript program:
function kthString ( n , k ) { var total = 0 ; var i = 1 ; while ( total < k ) { total = total + n - i ; i ++ ; } var first_y_position = i - 1 ; var second_y_position = k - ( total - n + first_y_position ) ; for ( var j = 1 ; j < first_y_position ; j ++ ) document . write ( " " ) ; document . write ( " " ) ; var j = first_y_position + 1 ; while ( second_y_position > 1 ) { document . write ( " " ) ; second_y_position -- ; j ++ ; } document . write ( " " ) ; while ( j < n ) { document . write ( " " ) ; j ++ ; } } var n = 5 ; var k = 7 ; kthString ( n , k ) ;

Accumulator variables: i, j, second_y_position
Iterator variables: j
Javascript program:
function countSubstr ( s , k ) { let n = s . length ; let l = n - 1 ; let r = n - 1 ; let arr = new Array ( n ) ; let last_indexof1 = - 1 ; for ( let i = 0 ; i < n ; i ++ ) { if ( s [ i ] == ' ' ) { arr [ i ] = i ; last_indexof1 = i ; } else { arr [ i ] = last_indexof1 ; } } let no_of_substr = 0 ; for ( r = n - 1 ; r >= 0 ; r -- ) { l = r ; while ( l >= 0 && ( r - l + 1 ) <= 64 && parseInt ( s . substring ( l , r + 1 ) , 2 ) < k ) { l -- ; } if ( r - l + 1 <= 64 ) no_of_substr += l + 1 ; else { no_of_substr += arr [ l + 1 ] + 1 ; } } return no_of_substr ; } let s = " " ; let k = 3 ; document . write ( countSubstr ( s , k ) ) ;

Index/key variables: i
Accumulator variables: i, l, no_of_substr, r
Iterator variables: i, r
Javascript program:
function isPerfectCubeString ( str ) { var sum = 0 ; for ( var i = 0 ; i < str . length ; i ++ ) { sum += str . charCodeAt ( i ) ; } var cr = Math . round ( Math . cbrt ( sum ) ) ; return cr * cr * cr == sum ; } var str = " " ; if ( isPerfectCubeString ( str ) ) document . write ( " " ) ; else document . write ( " " ) ;

Accumulator variables: i, sum
Iterator variables: i
Javascript program:
function XorAscii ( str , len ) { let ans = str . codePointAt ( 0 ) ; for ( let i = 1 ; i < len ; i ++ ) { ans = ( ans ^ ( str . codePointAt ( i ) ) ) ; } return ans ; } let str = " " ; let len = str . length ; document . write ( XorAscii ( str , len ) + " " ) ; str = " " ; len = str . length ; document . write ( XorAscii ( str , len ) ) ;

Accumulator variables: i
Iterator variables: i
Javascript program:
function encryption ( s ) { let l = s . length ; let b = Math . ceil ( Math . sqrt ( l ) ) ; let a = Math . floor ( Math . sqrt ( l ) ) ; let encrypted = ' ' ; if ( b * a < l ) { if ( Math . min ( b , a ) == b ) { b = b + 1 ; } else { a = a + 1 ; } } let arr = new Array ( ) ; for ( let i = 0 ; i < a ; i ++ ) { let temp = [ ] ; for ( let j = 0 ; j < b ; j ++ ) { temp . push ( [ ] ) } arr . push ( temp ) } for ( let i = 0 ; i < a ; i ++ ) { for ( let j = 0 ; j < b ; j ++ ) { arr [ i ] [ j ] = " " } } let k = 0 ; for ( let j = 0 ; j < a ; j ++ ) { for ( let i = 0 ; i < b ; i ++ ) { if ( k < l ) { arr [ j ] [ i ] = s [ k ] ; } k ++ ; } } for ( let j = 0 ; j < b ; j ++ ) { for ( let i = 0 ; i < a ; i ++ ) { encrypted = encrypted + arr [ i ] [ j ] ; } } return encrypted ; } function decryption ( s ) { let l = s . length ; let b = Math . ceil ( Math . sqrt ( l ) ) ; let a = Math . floor ( Math . sqrt ( l ) ) ; let decrypted = ' ' ; let arr = new Array ( ) ; for ( let i = 0 ; i < a ; i ++ ) { let temp = [ ] ; for ( let j = 0 ; j < b ; j ++ ) { temp . push ( [ ] ) } arr . push ( temp ) } for ( let i = 0 ; i < a ; i ++ ) { for ( let j = 0 ; j < b ; j ++ ) { arr [ i ] [ j ] = " " } } let k = 0 ; for ( let j = 0 ; j < b ; j ++ ) { for ( let i = 0 ; i < a ; i ++ ) { if ( k < l ) { arr [ j ] [ i ] = s [ k ] ; } k ++ ; } } for ( let j = 0 ; j < a ; j ++ ) { for ( let i = 0 ; i < b ; i ++ ) { decrypted = decrypted + arr [ i ] [ j ] ; } } return decrypted ; } let s = " " ; let encrypted ; let decrypted ; encrypted = encryption ( s ) ; document . write ( encrypted + " " ) ; decrypted = decryption ( encrypted ) ; document . write ( decrypted ) ;

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i, j
Javascript program:
function checkIfAllVowels ( str ) { var hash = Array ( 5 ) . fill ( 0 ) ; for ( var i = 0 ; i < str . length ; i ++ ) { if ( str [ i ] == ' ' str [ i ] == ' ' ) hash [ 0 ] = 1 ; else if ( str [ i ] == ' ' str [ i ] == ' ' ) hash [ 1 ] = 1 ; else if ( str [ i ] == ' ' str [ i ] == ' ' ) hash [ 2 ] = 1 ; else if ( str [ i ] == ' ' str [ i ] == ' ' ) hash [ 3 ] = 1 ; else if ( str [ i ] == ' ' str [ i ] == ' ' ) hash [ 4 ] = 1 ; } for ( var i = 0 ; i < 5 ; i ++ ) { if ( hash [ i ] == 0 ) { return 1 ; } } return 0 ; } function checkIfAllVowelsArePresent ( str ) { if ( checkIfAllVowels ( str ) ) document . write ( " " ) ; else document . write ( " " ) ; } var str = " " ; checkIfAllVowelsArePresent ( str ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function smallest ( s ) { var a = Array ( s . length ) ; for ( var i = 0 ; i < s . length ; i ++ ) a [ i ] = s [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ; var b = [ ] ; for ( var i = 0 ; i < a . length ; i ++ ) { if ( ( a [ i ] ) % 2 != 0 ) b . push ( a [ i ] ) ; } b . sort ( ( a , b ) => a - b ) ; if ( b . length > 1 ) return ( b [ 0 ] ) * 10 + ( b [ 1 ] ) ; return - 1 ; } document . write ( smallest ( " " ) ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function converthenumber ( n ) { var s = n . toString ( ) ; var res = " " ; var i ; for ( i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == ' ' s [ i ] == ' ' s [ i ] == ' ' s [ i ] == ' ' s [ i ] == ' ' ) res += s [ i ] ; if ( res . length == 2 ) break ; } if ( res . length == 2 ) document . write ( res ) ; else document . write ( " " ) ; } var n = 18720 ; converthenumber ( n ) ;

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
Javascript program:
function longestPalindrome ( a , n ) { var pair1 = Array ( n ) ; var pair2 = Array ( n ) ; var r = 0 ; for ( var i = 0 ; i < n ; i ++ ) { var s = a [ i ] ; s = s . split ( ' ' ) . reverse ( ) . join ( ' ' ) ; for ( var j = i + 1 ; j < n ; j ++ ) { if ( a [ i ] != " " && a [ j ] != " " ) { if ( s == a [ j ] ) { pair1 [ r ] = a [ i ] ; pair2 [ r ++ ] = a [ j ] ; a [ i ] = " " ; a [ j ] = " " ; break ; } } } } var s1 = " " ; for ( var i = 0 ; i < n ; i ++ ) { var s = a [ i ] ; a [ i ] = a [ i ] . split ( ' ' ) . reverse ( ) . join ( ' ' ) ; if ( a [ i ] != " " ) { if ( a [ i ] == s ) { s1 = a [ i ] ; break ; } } } var ans = " " ; for ( var i = 0 ; i < r ; i ++ ) { ans = ans + pair1 [ i ] ; } if ( s1 != " " ) { ans = ans + s1 ; } for ( var j = r - 1 ; j >= 0 ; j -- ) { ans = ans + pair2 [ j ] ; } document . write ( ans + " " ) ; } var a1 = [ " " , " " ] ; var n1 = a1 . length ; longestPalindrome ( a1 , n1 ) ; var a2 = [ " " , " " , " " , " " , " " ] ; var n2 = a2 . length ; longestPalindrome ( a2 , n2 ) ;

Index/key variables: i, j, r
Accumulator variables: i, j, r
Iterator variables: i, j
Javascript program:
function printValue ( digit ) { switch ( digit ) { case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; case " " : document . write ( " " ) ; break ; } } function printWord ( N ) { var i , length = N . length ; for ( i = 0 ; i < length ; i ++ ) { printValue ( N [ i ] ) ; } } var N = " " ; printWord ( N ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
class TrieNode { constructor ( x ) { this . val = x ; this . visited = 0 ; this . children = new Map ( ) ; } } class Trie { constructor ( ) { this . head = new TrieNode ( ' \0 ' ) ; this . ans = 0 ; } addWord ( s ) { let temp = this . head ; let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { let ch = s [ i ] ; if ( temp . children . get ( ch ) == null ) { temp . children . set ( ch , new TrieNode ( ch ) ) ; } temp = temp . children . get ( ch ) ; temp . visited ++ ; } } dfs ( node , depth ) { let vis = 0 ; for ( let [ key , value ] of node . children . entries ( ) ) { vis += this . dfs ( value , depth + 1 ) ; } node . visited -= vis ; let String_pair = 0 ; if ( node . visited > 1 ) { String_pair = ( node . visited / 2 ) ; this . ans += ( depth * String_pair ) ; node . visited -= ( 2 * String_pair ) ; } return ( 2 * String_pair + vis ) ; } dfshelper ( ) { this . ans = 0 ; this . dfs ( this . head , 0 ) ; return this . ans ; } } let T = new Trie ( ) ; let str = [ " " , " " , " " , " " , " " , " " ] ; let n = 6 ; for ( let i = 0 ; i < n ; i ++ ) { T . addWord ( str [ i ] ) ; } let ans = T . dfshelper ( ) ; document . write ( ans ) ;

Index/key variables: i
Accumulator variables: ans, i, vis, visited
Iterator variables: i
Class/struct names: Trie, TrieNode
Javascript program:
function jaro_distance ( s1 , s2 ) { if ( s1 == s2 ) return 1.0 ; var len1 = s1 . length , len2 = s2 . length ; var max_dist = Math . floor ( Math . max ( len1 , len2 ) / 2 ) - 1 ; var match = 0 ; var hash_s1 = Array ( s1 . length ) . fill ( 0 ) ; var hash_s2 = Array ( s1 . length ) . fill ( 0 ) ; for ( var i = 0 ; i < len1 ; i ++ ) { for ( var j = Math . max ( 0 , i - max_dist ) ; j < Math . min ( len2 , i + max_dist + 1 ) ; j ++ ) if ( s1 [ i ] == s2 [ j ] && hash_s2 [ j ] == 0 ) { hash_s1 [ i ] = 1 ; hash_s2 [ j ] = 1 ; match ++ ; break ; } } if ( match == 0 ) return 0.0 ; var t = 0 ; var point = 0 ; for ( var i = 0 ; i < len1 ; i ++ ) if ( hash_s1 [ i ] ) { while ( hash_s2 [ point ] == 0 ) point ++ ; if ( s1 [ i ] != s2 [ point ++ ] ) t ++ ; } t /= 2 ; return ( ( match ) / ( len1 ) + ( match ) / ( len2 ) + ( match - t ) / ( match ) ) / 3.0 ; } var s1 = " " , s2 = " " ; document . write ( jaro_distance ( s1 , s2 ) . toFixed ( 5 ) ) ;

Index/key variables: i, j, point
Accumulator variables: i, j, match, point, t
Iterator variables: i, j
Javascript program:
class node { constructor ( ) { this . data = ' ' ; this . cnt = 0 ; this . left = null ; this . right = null ; } } ; function add ( data ) { var newnode = new node ( ) ; newnode . data = data ; newnode . cnt = 1 ; newnode . left = newnode . right = null ; return newnode ; } function addinlvlorder ( root , data ) { if ( root == null ) { return add ( data ) ; } var Q = [ ] ; Q . push ( root ) ; while ( Q . length != 0 ) { var temp = Q [ 0 ] ; Q . shift ( ) ; if ( temp . data == data ) { temp . cnt ++ ; break ; } if ( temp . left == null ) { temp . left = add ( data ) ; break ; } else { if ( temp . left . data == data ) { temp . left . cnt ++ ; break ; } Q . push ( temp . left ) ; } if ( temp . right == null ) { temp . right = add ( data ) ; break ; } else { if ( temp . right . data == data ) { temp . right . cnt ++ ; break ; } Q . push ( temp . right ) ; } } return root ; } function printlvlorder ( root ) { var Q = [ ] ; Q . push ( root ) ; while ( Q . length != 0 ) { var temp = Q [ 0 ] ; if ( temp . cnt > 1 ) { document . write ( ( temp . data + " " + temp . cnt ) ) ; } else { document . write ( temp . data ) ; } Q . shift ( ) ; if ( temp . left != null ) { Q . push ( temp . left ) ; } if ( temp . right != null ) { Q . push ( temp . right ) ; } } } var s = " " ; var root = null ; for ( var i = 0 ; i < s . length ; i ++ ) { root = addinlvlorder ( root , s [ i ] ) ; } printlvlorder ( root ) ;

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: node
Javascript program:
function canMake ( s ) { var o = 0 , z = 0 ; for ( i = 0 ; i < s . length ; i ++ ) { if ( s . charAt ( i ) . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) == 1 ) o ++ ; else z ++ ; } if ( o % 2 == 1 && z % 2 == 1 ) return " " ; else return " " ; } var s = " " ; document . write ( canMake ( s ) ) ;

Accumulator variables: i, o, z
Iterator variables: i
Javascript program:
let count = 0 ; function countNumberOfStringsUtil ( freq ) { for ( let i = 0 ; i < 26 ; i ++ ) { if ( freq [ i ] > 0 ) { freq [ i ] -- ; count ++ ; countNumberOfStringsUtil ( freq ) ; } } } function countNumberOfStrings ( s ) { let freq = new Array ( 26 ) ; for ( let i = 0 ; i < freq . length ; i ++ ) { freq [ i ] = 0 ; } for ( let i = 0 ; i < s . length ; i ++ ) { freq [ s [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; } countNumberOfStringsUtil ( freq ) ; return count ; } let s = " " ; document . write ( countNumberOfStrings ( s ) ) ;

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Javascript program:
function findMinSwaps ( s , k ) { var ans = 0 ; var c_one = 0 , c_zero = 0 ; for ( var i = s . length - 1 ; i >= 0 ; i -- ) { if ( s [ i ] == ' ' ) c_one ++ ; if ( s [ i ] == ' ' ) c_zero ++ , ans += c_one ; if ( c_zero == k ) break ; } if ( c_zero < k ) return - 1 ; return ans ; } var s = " " ; var k = 2 ; document . write ( findMinSwaps ( s , k ) ) ;

Index/key variables: i
Accumulator variables: ans, c_one, c_zero, i
Iterator variables: i
Javascript program:
class Node { constructor ( _val ) { this . data = _val ; this . left = null ; this . right = null ; } } ; function addinBT ( root , data ) { if ( root == null ) { root = new Node ( data ) ; } else { var Q = [ ] ; Q . push ( root ) ; while ( Q . length != 0 ) { var temp = Q [ 0 ] ; Q . shift ( ) ; if ( temp . left == null ) { temp . left = new Node ( data ) ; break ; } else Q . push ( temp . left ) ; if ( temp . right == null ) { temp . right = new Node ( data ) ; break ; } else Q . push ( temp . right ) ; } } return root ; } function print ( root ) { var Q = [ ] Q . push ( root ) ; while ( Q . length > 0 ) { var temp = Q [ 0 ] ; Q . shift ( ) ; document . write ( temp . data ) ; if ( temp . left != null ) Q . push ( temp . left ) ; if ( temp . right != null ) Q . push ( temp . right ) ; } } function checkvowel ( ch ) { ch = ch . toLowerCase ( ) ; if ( ch == " " ch == " " ch == " " ch == " " ch == " " ) { return true ; } else { return false ; } } function removevowels ( root ) { var Q = [ ] Q . push ( root ) ; var root1 = null ; while ( Q . length != 0 ) { var temp = Q [ 0 ] ; Q . shift ( ) ; if ( ! checkvowel ( temp . data ) ) { root1 = addinBT ( root1 , temp . data ) ; } if ( temp . left != null ) { Q . push ( temp . left ) ; } if ( temp . right != null ) { Q . push ( temp . right ) ; } } return root1 ; } var s = " " ; var root = null ; for ( var i = 0 ; i < s . length ; i ++ ) { root = addinBT ( root , s [ i ] ) ; } root = removevowels ( root ) ; print ( root ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: Node
Javascript program:
function countSubStr ( str , len ) { var ans = 0 ; for ( var i = 0 ; i < len ; i ++ ) { if ( str [ i ] == ' ' ) ans += ( i + 1 ) ; } return ans ; } var str = " " ; var len = str . length ; document . write ( countSubStr ( str , len ) ) ;

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Javascript program:
function findLength ( s , k ) { var ans = 1000000000 ; var l = 0 ; var r = 0 ; var cnt_zero = 0 , cnt_one = 0 ; while ( l < s . length && r <= s . length ) { if ( cnt_zero >= k && cnt_one >= 1 ) { ans = Math . min ( ans , r - l ) ; l ++ ; if ( s [ l - 1 ] == ' ' ) cnt_zero -- ; else cnt_one -- ; } else { if ( r == s . length ) break ; if ( s [ r ] == ' ' ) cnt_zero ++ ; else cnt_one ++ ; r ++ ; } } if ( ans == 1000000000 ) return - 1 ; return ans ; } var s = " " ; var k = 2 ; document . write ( findLength ( s , k ) ) ;

Index/key variables: r
Accumulator variables: cnt_one, cnt_zero, l, r
Javascript program:
var MAX = 26 ; function areEqual ( a , b ) { for ( var i = 0 ; i < MAX ; i ++ ) if ( a [ i ] != b [ i ] ) return false ; return true ; } function xExistsInY ( x , y ) { if ( x . length > y . length ) return false ; var cnt_x = Array ( MAX ) . fill ( 0 ) ; var cnt = Array ( MAX ) . fill ( 0 ) ; for ( var i = 0 ; i < x . length ; i ++ ) cnt_x [ x [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; for ( var i = 0 ; i < x . length ; i ++ ) cnt [ y [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; if ( areEqual ( cnt_x , cnt ) ) return true ; for ( var i = 1 ; i < y . length - x . length + 1 ; i ++ ) { cnt [ y [ i - 1 ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] -- ; cnt [ y [ i + x . length - 1 ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; if ( areEqual ( cnt , cnt_x ) ) return true ; } return false ; } var x = " " ; var y = " " ; if ( xExistsInY ( x , y ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function reverse ( A , l , h ) { if ( l < h ) { let ch = A [ l ] ; A [ l ] = A [ h ] ; A [ h ] = ch ; reverse ( A , l + 1 , h - 1 ) ; } } function reverseParentheses ( str , len ) { let st = [ ] ; for ( let i = 0 ; i < len ; i ++ ) { if ( str [ i ] == ' ' ) { st . push ( i ) ; } else if ( str [ i ] == ' ' ) { let A = [ ... str ] reverse ( A , st [ st . length - 1 ] + 1 , i ) ; str = [ ... A ] ; st . pop ( ) ; } } let res = " " ; for ( let i = 0 ; i < len ; i ++ ) { if ( str [ i ] != ' ' && str [ i ] != ' ' ) { res += ( str [ i ] ) ; } } return res ; } let str = " " ; let len = str . length ; document . write ( reverseParentheses ( str , len ) ) ;

Index/key variables: h, i, l
Accumulator variables: i, res
Iterator variables: i
Javascript program:
const MAX = 26 ; function updateFreq ( str , freq ) { var len = str . length ; for ( var i = 0 ; i < len ; i ++ ) { freq [ str [ i ] . charCodeAt ( 0 ) - " " . charCodeAt ( 0 ) ] ++ ; } } function maxCount ( str , patt ) { var strFreq = new Array ( MAX ) . fill ( 0 ) ; updateFreq ( str , strFreq ) ; var pattFreq = new Array ( MAX ) . fill ( 0 ) ; updateFreq ( patt , pattFreq ) ; var ans = 21474836473 ; for ( var i = 0 ; i < MAX ; i ++ ) { if ( pattFreq [ i ] == 0 ) continue ; ans = Math . min ( ans , strFreq [ i ] / pattFreq [ i ] ) ; } return ans ; } var str = " " ; var patt = " " ; document . write ( maxCount ( str , patt ) ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
var TEN = 10 ; function minNum ( str , len ) { var res = Number . MAX_VALUE ; for ( var i = 0 ; i < len ; i ++ ) { if ( str [ i ] == ' ' str [ i ] == ' ' ) { res = Math . min ( res , str [ i ] - ' ' ) ; } } for ( i = 0 ; i < len - 1 ; i ++ ) { for ( j = i + 1 ; j < len ; j ++ ) { var num = ( str [ i ] - ' ' ) * TEN + ( str [ j ] - ' ' ) ; if ( num % 4 == 0 ) { res = Math . min ( res , num ) ; } } } return ( ( res == Number . MAX_VALUE ) ? - 1 : res ) ; } var str = " " ; var len = str . length ; document . write ( minNum ( str , len ) ) ;

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Javascript program:
function canBeEqual ( a , b , n ) { let A = [ ] ; let B = [ ] ; for ( let i = 0 ; i < n ; i ++ ) { if ( a [ i ] != b [ i ] ) { A . push ( a [ i ] ) ; B . push ( b [ i ] ) ; } } if ( A . length == B . length && B . length == 0 ) return true ; if ( A . length == B . length && B . length == 2 ) { if ( A [ 0 ] == A [ 1 ] && B [ 0 ] == B [ 1 ] ) return true ; } return false ; } let A = " " . split ( " " ) ; let B = " " . split ( " " ) ; if ( canBeEqual ( A , B , A . length ) ) document . write ( " " ) ; else document . write ( " " ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function findMidAlphabet ( s1 , s2 , n ) { for ( var i = 0 ; i < n ; i ++ ) { var mid = ( s1 [ i ] . charCodeAt ( 0 ) + s2 [ i ] . charCodeAt ( 0 ) ) / 2 ; document . write ( String . fromCharCode ( mid ) ) ; } } var s1 = " " ; var s2 = " " ; var n = s1 . length ; findMidAlphabet ( s1 , s2 , n ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
var N = 2 ; function isVowel ( ch ) { return ( ch == ' ' ch == ' ' ch == ' ' ch == ' ' ch == ' ' ) ; } function performQueries ( str , len , queries , q ) { var pre = Array ( len ) ; if ( isVowel ( str [ 0 ] ) ) pre [ 0 ] = 1 ; else pre [ 0 ] = 0 ; for ( var i = 1 ; i < len ; i ++ ) { if ( isVowel ( str [ i ] ) ) pre [ i ] = 1 + pre [ i - 1 ] ; else pre [ i ] = pre [ i - 1 ] ; } for ( var i = 0 ; i < q ; i ++ ) { if ( queries [ i ] [ 0 ] == 0 ) { document . write ( pre [ queries [ i ] [ 1 ] ] + " " ) ; } else { document . write ( pre [ queries [ i ] [ 1 ] ] - pre [ queries [ i ] [ 0 ] - 1 ] + " " ) ; } } } var str = " " ; var len = str . length ; var queries = [ [ 1 , 3 ] , [ 2 , 4 ] , [ 1 , 9 ] ] ; var q = queries . length performQueries ( str , len , queries , q ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Javascript program:
function sumDigits ( n ) { var sum = 0 ; while ( n > 0 ) { var digit = n % 10 ; sum += digit ; n = parseInt ( n / 10 ) ; } return sum ; } function isDivBySix ( str , n ) { var sum = 0 ; for ( var i = 0 ; i < n ; i ++ ) { sum += ( str [ i ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) + 1 ) ; } if ( sum % 3 != 0 ) return false ; var lastDigit = ( ( str [ n - 1 ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) + 1 ) ) % 10 ; if ( lastDigit % 2 != 0 ) return false ; return true ; } var str = " " ; var n = str . length ; if ( isDivBySix ( str , n ) ) document . write ( " " ) ; else document . write ( " " ) ;

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