FastPrepWord Path Moving Only Right or Down
Problems/Word Path Moving Only Right or Down

Word Path Moving Only Right or Down

Atlassian logoAtlassian● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Atlassian full-time phone screen. The task of giving coordinates is about 90% the same as the report. We read the sample paths as moving only right and down, instead of following an unfinished attempt that disagrees. We chose how the path is picked, how indexing works, the row-string interface with limits, and what happens when no path exists.

Given a letter grid grid and a string word, return the coordinates of a path that spells word. Each row of grid is a string, all rows have the same length, and both inputs are nonempty.

The path may start at any cell. Each next letter must be in the cell directly to the right of the previous letter or directly below it. Return one coordinate [row,column] per letter, in word order. Rows and columns are numbered from zero.

If several paths spell the word, return the smallest one: compare two paths at the first coordinate where they differ, by row first and then by column. This means the path starts at the earliest cell, row by row and left to right, that can finish the word, and it moves right rather than down whenever moving right can still finish it.

If no path spells the word, return an empty array.

Function

gridPath(grid: String[], word: String) → int[][]

Examples

Example 1

grid = ["bbballoo","baccescn","altewcew","alossecc","woowacaw","ibwowwow"]word = "access"return = [[1,1],[1,2],[1,3],[2,3],[3,3],[3,4]]
grid
012345670bbballoo1baccescn2altewcew3alossecc4woowacaw5ibwowwow
→
return
01011112213323433534

Start at the a at [1,1]. Move right to the two c cells at [1,2] and [1,3], down to e at [2,3] and s at [3,3], then right to the last s at [3,4]. No earlier starting cell can spell the word.

Example 2

grid = ["bbballoo","baccescn","altewcew","alossecc","woowacaw","ibwowwow"]word = "balloon"return = [[0,2],[0,3],[0,4],[0,5],[0,6],[0,7],[1,7]]
grid
012345670bbballoo1baccescn2altewcew3alossecc4woowacaw5ibwowwow
→
return
01002103204305406507617

The b cells at [0,0] and [0,1] cannot complete the word, so the path starts at [0,2]. It moves right along row 0 through a, l, l, o, o, then down to n at [1,7].

Example 3

grid = ["ab","cd"]word = "aa"return = []
grid
010ab1cd

The only a has no a to its right or below, so no path spells the word and the answer is empty.

Constraints

  • The grid's height and width are each from 1 through 12, and all row lengths are equal.
  • 1 <= word.length <= height + width - 1.
  • All characters are lowercase English letters.

More Atlassian Phone Screen questions

  • Merge Overlapping IntervalsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Tennis Court SchedulingPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Implement a Rate LimiterPHONE SCREEN · Seen Oct 2026
  • Longest Consistent Activity StreakPHONE SCREEN · Seen Sep 2026
  • Music Player Operation SequencePHONE SCREEN · Seen Sep 2026
  • Underline Shortest Unique SubstringsPHONE SCREEN · Seen Aug 2026
  • Can a Dictionary Word Be Formed from Note Letters?PHONE SCREEN · Seen Feb 2026
  • Ordered Badge Entry and Exit ViolationsPHONE SCREEN · Seen Aug 2025
  • Two Sum with an Ordered Index PairPHONE SCREEN · Seen Aug 2025
  • Can You Finish the Teleporter Board?PHONE SCREEN · Seen Jul 2025

Similar questions at other companies

  • Classify Password StrengthHackerRank · OA · PHONE SCREEN · ONSITE INTERVIEWHackerRank interview questions
  • Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Dasher Pay with Store Waits and Peak HoursDoorDash · PHONE SCREENDoorDash interview questions
  • Fuzzy Word Lookup With One Misspelled LetterMeta · PHONE SCREENMeta interview questions
  • Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Group Timestamps into Consecutive-Day IntervalsDuolingo · PHONE SCREENDuolingo interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Longest Substring Without Repeating CharactersAngel One · PHONE SCREEN

Atlassian interview experiences

  • Atlassian MLE Phone Screen: Model Deployment Design: 1 Experience
  • Atlassian Coding Screens and Karat: 3 Experiences (Part 2 of 2)
  • Atlassian Full Stack Interviews: 11 Experiences (Part 1 of 2)
All Atlassian interview questionsSee Atlassian hiring insights
Saved
class Solution {
    public int[][] gridPath(String[] grid, String word) {
        // Write your code here.
        return new int[0][0];
    }
}
Checking account…