Given a two-dimensional array of letters, find whether a given word can be written in any one of the 8 directions.
In other words, the word may appear horizontally, vertically, or diagonally in any direction.
Example 1
Input: UBER
A U I K F W N
W O B O L X P
T L A E R E C
Y Z X E R L W
Output: true
Example 2
Input: UBER
U B
E R
Output: false
This problem asks whether a target word can be formed in a 2D grid by moving in any of the 8 directions: horizontal, vertical, and diagonal. A standard solution is to try each cell as a starting point, then check all 8 direction vectors to see whether the full word matches consecutively. The key ideas are grid traversal, direction arrays, and early stopping once a match is found.