FastPrepCount Right-or-Down Word Paths with One Turn
Problems/Count Right-or-Down Word Paths with One Turn

Count Right-or-Down Word Paths with One Turn

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes a character matrix, many words, contiguous paths going right or down, at most one change of direction, and adding up occurrences across words. We supplied counting distinct coordinate paths, counting duplicate words, removing duplicates for one-letter words, limits, and a String[] board input. Our version is about 88% the same as the reported question.

For each word, count distinct coordinate paths in board that spell it. A path starts anywhere, moves one cell right or down per character, and changes direction at most once. A path never leaves the board.

Sum occurrences over all words, counting duplicate words independently. A one-character occurrence is counted once per matching cell.

Function

countWordPaths(board: String[], words: String[]) → int

Examples

Example 1

board = ["abc","def","ghi"]words = ["abc","adg","aei"]return = 2
board
0120abc1def2ghi

Horizontal, vertical, and one-turn paths are all eligible.

Example 2

board = ["aa","ab"]words = ["a"]return = 3
board
010aa1ab

Each matching cell contributes once.

Constraints

  • 1 <= board rows, columns <= 50
  • 1 <= words.length <= 100
  • 1 <= words[i].length <= 100

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Repair One Movement InstructionOpenAI · OAOpenAI interview questions
  • Count Straight-Line Word Occurrences in a GridOptiver · OAOptiver interview questions
  • Count Straight-Line Word Occurrences in a GridVisa · OAVisa interview questions
  • Count Grid Words with One TurnCapital One · OACapital One interview questions
  • Find a Word in Eight Straight DirectionsIntuit · OAIntuit interview questions
  • Flip Rows and Columns, Count ZerosNutanix · OANutanix interview questions
  • Hidden ArtifactsIMC Trading · OAIMC Trading interview questions
  • Lexicographically Smallest Grid Path with One Letter ChangeInfosys · OAInfosys interview questions
  • Balance a Chemical EquationMicrosoft · OAMicrosoft interview questions
  • Simulate a Deterministic Finite AutomatonPoint72 · OAPoint72 interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int countWordPaths(String[] board, String[] words) {
        // Write your code here.
    }

}
Checking account…