wes d2a2ba9e15 first commit | 4 years ago | |
---|---|---|
.. | ||
README.md | 4 years ago | |
code.cpp | 4 years ago | |
unitTest.cpp | 4 years ago |
by Helen Yu tags: arrays, higher_order_functions
Create a function that counts the number of times a particular letter shows up in the word search. Examples letterCounter([ ["D", "E", "Y", "H", "A", "D"], ["C", "B", "Z", "Y", "J", "K"], ["D", "B", "C", "A", "M", "N"], ["F", "G", "G", "R", "S", "R"], ["V", "X", "H", "A", "S", "S"] ], "D") ➞ 3 // "D" shows up 3 times: twice in the first row, once i
Create a function that counts the number of times a particular letter shows up in the word search.
letterCounter([
["D", "E", "Y", "H", "A", "D"],
["C", "B", "Z", "Y", "J", "K"],
["D", "B", "C", "A", "M", "N"],
["F", "G", "G", "R", "S", "R"],
["V", "X", "H", "A", "S", "S"]
], "D") ➞ 3
// "D" shows up 3 times: twice in the first row, once in the third row.
letterCounter([
["D", "E", "Y", "H", "A", "D"],
["C", "B", "Z", "Y", "J", "K"],
["D", "B", "C", "A", "M", "N"],
["F", "G", "G", "R", "S", "R"],
["V", "X", "H", "A", "S", "S"]
], "H") ➞ 2
You will always be given an array with five sub-arrays.