As reported: TikTok Android Software Engineer (2-2, Singapore) loop (2025), round 1 (technical): a coding question in the style of Word Search.
This is LeetCode 79 — Word Search.
Given an m × n grid of characters board and a string word, return true if word exists in the grid.
The word is built from letters of sequentially adjacent cells — horizontally or vertically neighbouring. The same cell may not be used more than once in a word.
Example 1
board = [["A","B","C","E"],
["S","F","C","S"],
["A","D","E","E"]]
word = "ABCCED"
Output: true
Example 2
same board, word = "SEE"
Output: true
Example 3
same board, word = "ABCB"
Output: false
The path would need to reuse the B.
Constraints: 1 ≤ m, n ≤ 6; 1 ≤ word.length ≤ 15; board and word consist of uppercase and lowercase English letters.
Code runner format: one JSON value per line: board, word. Implement exist(board, word); the harness prints true or false.