Сегодня занимался ещё одним тестом. Ограничение по времени 80 минут. 3 задания: 2 по 30мин. и 1 на 20 мин.
Задание #1.
In a Word-Search Puzzle, the player receives a rectangular-shaped grid of letters (a board) and a list of target words. The player is required to locate each target word from the list on the board.
In this question, you are asked to implement a function that receives as input a two-dimensional array of characters and a target word, and returns “true” if the target word appears in the array and “false” if it doesn’t.
For example, given the array
[
['b', 'a', 'n', 't'],
['c', 'f', 'r', 'g']
]
and the target word "ant",
the function should return "true" (because the word appears horizontally in the top row).
Note - the words must appear either horizontally or vertically (not diagonally). All the letters of the word must appear contiguously (i.e., with no unrelated letters in between).
Examples:
Input:
board = [ ['f', 'g', 'a', 'b'], ['b', 'o', 't', 't'], ['e', 'd', 'x', 'p'] ]
targetWord = "dog"
Output: true
Input:
board = [ ['g', 'h', 'c'], ['f', 'm', 'o'] ]
targetWord = "go"
Output: false
Начал делать этот тест, но потом просто забил на это. В общем ещё одна вакансия долой.
Буду готовиться к следующему тестику.