wes d2a2ba9e15 first commit 4 年 前
..
README.md d2a2ba9e15 first commit 4 年 前
code.cpp d2a2ba9e15 first commit 4 年 前
unitTest.cpp d2a2ba9e15 first commit 4 年 前

README.md

Count Letters in a Word Search

by Helen Yu tags: arrays, higher_order_functions

Summary

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

Instructions

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 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

Notes

You will always be given an array with five sub-arrays.