Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def stringsCrossover(inputArray, result)
- count = 0
- chars = result.chars.map{|ch| ch.downcase}
- i = 0
- while (i < inputArray.length)
- j = i + 1
- while (j < inputArray.length)
- chars1 = inputArray[i].chars.map{|ch| ch.downcase}
- chars2 = inputArray[j].chars.map{|ch| ch.downcase}
- isCross = true
- k = 0
- while (k < chars.length)
- if chars[k] != chars1[k] and chars[k] != chars2[k] then
- isCross = false
- break
- end
- k = k + 1
- end
- if isCross == true then
- count = count + 1
- end
- j = j + 1
- end
- i = i + 1
- end
- return count
- end
Add Comment
Please, Sign In to add comment