text: Print the most occurring character in an array of strings | Function to print the most occurring character ; Creating a hash of size 26 ; For loop to iterate through every string of the array ; For loop to iterate through every character of the string ; Incrementing the count of the character in the hash ; Finding the character with the maximum count ; Declaring Vector of String type
code: function findMostOccurringChar ( str ) { var hash = Array ( 26 ) . fill ( 0 ) ; for ( var i = 0 ; i < str . length ; i ++ ) { for ( var j = 0 ; j < str [ i ] . length ; j ++ ) { hash [ str [ i ] [ j ] ] ++ ; } } var max = 0 ; for ( var i = 0 ; i < 26 ; i ++ ) { max = hash [ i ] > hash [ max ] ? i : max ; } document . write ( String . fromCharCode ( max + 97 ) ) ; } var str = [ ] ; str . push ( " " ) ; str . push ( " " ) ; str . push ( " " ) ; str . push ( " " ) ; findMostOccurringChar ( str ) ;