FastPrepWord Search II
Problems/Word Search II

Word Search II

Kotak Mahindra Bank logoKotak Mahindra Bank● HardFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: A first-hand Kotak report directly names Word Search II. Input bounds, duplicate handling, and deterministic output order are practice assumptions; the judged core matches at about 96%.

Given a rectangular board of lowercase letters and a list of lowercase words, return every distinct input word that can be formed by a path through horizontally or vertically adjacent cells.

A cell may be used at most once within one word. Return matching words in the order of their first appearance in words.

Function

findWords(board: String[], words: String[]) → String[]

Examples

Example 1

board = ["oaan","etae","ihkr","iflv"]words = ["oath","pea","eat","rain"]return = ["oath","eat"]

Both returned words have valid adjacent-cell paths.

Example 2

board = ["ab","cd"]words = ["ab","abc","abd","ab"]return = ["ab","abd"]

Duplicate input words are returned once, and diagonal movement is not allowed.

Constraints

  • 1 <= board.length, board[i].length <= 12.
  • 1 <= words.length <= 30000.
  • 1 <= words[i].length <= 10.
  • Rows have equal length and all characters are lowercase English letters.

More Kotak Mahindra Bank problems

  • Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Nov 2026
  • Best Time to Buy and Sell Stock IIONSITE INTERVIEW · Seen Nov 2026
  • Maximum Non-Adjacent Coins in Two RowsONSITE INTERVIEW · Seen Oct 2026
All Kotak Mahindra Bank interview questionsSee Kotak Mahindra Bank hiring insights
Saved
class Solution {
    public String[] findWords(String[] board, String[] words) {
        // Return found words in first-input order.
    }
}
Checking account…