Count pair of strings whose concatenation has every vowel | Function to return the count of all concatenated string with each vowel at least once ; Concatenating all possible pairs of string ; Creating an array which checks , the presence of each vowel ; Checking for each vowel by traversing the concatenated string ; Checking if all the elements are set in vowel [ ] ; Check if all vowels are present or not ; Return the final count ; Given array of strings ; Function Call
function good_pair ( str , N ) { let countStr = 0 ; for ( let i = 0 ; i < N ; i ++ ) { for ( let j = i + 1 ; j < N ; j ++ ) { let res = str [ i ] + str [ j ] ; let vowel = new Array ( 5 ) ; vowel . fill ( 0 ) ; for ( let k = 0 ; k < res . length ; k ++ ) { if ( res [ k ] == ' ' ) vowel [ 0 ] = 1 ; else if ( res [ k ] == ' ' ) vowel [ 1 ] = 1 ; else if ( res [ k ] == ' ' ) vowel [ 2 ] = 1 ; else if ( res [ k ] == ' ' ) vowel [ 3 ] = 1 ; else if ( res [ k ] == ' ' ) vowel [ 4 ] = 1 ; } let temp = 0 ; for ( let ind = 0 ; ind < 5 ; ind ++ ) { if ( vowel [ ind ] == 1 ) temp ++ ; } if ( temp == 5 ) countStr ++ ; } } return countStr ; } let arr = [ " " , " " ] ; let N = arr . length ; document . write ( good_pair ( arr , N ) ) ;