bitcanny

array of sentences

array of queries

for each

change string into array of words and store in variable

for Each

let s = array of words in sentences

change string into array of words and store in variable

let q = array of words in query

for Each (q_word)

if

array s doesn't contain

this word

q_word

and

let allWordsExist = true

this word is true

change this variable to false

and

IF

this variable

ELSE

do nothing

is true

get no. of times each word exists

take this array of query

let eachLine = [ ]

let count = 0

for Each

after this loop ends

take this array of words in sentence

var = x (word in query)

for Each

var y = word in sentence

IF

Y = X

increment count

after this loop ends

get count

eachRepetedNum = [ ]

push to this array

find Math.min()
this is the min times all words repeated

repeat next loop this many times

reset count

push to array the index of sentence

this take this array

index of each sentence

push it to this main array

arr_results