FastPrepEnumerate Grid Paths
Problems/Enumerate Grid Paths

Enumerate Grid Paths

Motive logoMotive● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand Motive onsite report for a full-time role asks to list all the Unique Paths. We chose the D/R string form, the lexicographic order, and the limits.

Our version is about 90% the same as the reported question.

Starting at the top-left cell of a rows-by-cols grid, move only down (D) or right (R) until the bottom-right cell. Return every path as a move string in lexicographic order.

Function

enumerateGridPaths(rows: int, cols: int) → String[]

Examples

Example 1

rows = 2cols = 3return = ["DRR","RDR","RRD"]

Example 2

rows = 1cols = 1return = [""]

Constraints

  • 1 <= rows, cols <= 8.

More Motive Onsite Interview questions

  • Group AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Longest Equal-Zero-One SubarrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Maximum Weighted Sum After Left RotationsONSITE INTERVIEW · Seen Jan 2026
  • Valid Parenthesis StringPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Dec 2025
  • Target Triplet SumONSITE INTERVIEW · Seen Dec 2025
  • Validate IP AddressONSITE INTERVIEW · Seen Dec 2025
  • Generate Palindromic PermutationsONSITE INTERVIEW · Seen Dec 2025
  • Minimum Swaps to Group Circular OnesONSITE INTERVIEW · Seen Dec 2025
  • Staircase Search In A Sorted MatrixONSITE INTERVIEW · Seen Dec 2025

Similar questions at other companies

  • Generate Fixed-Size CombinationsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Generate One-Two Strings with Sum NGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Generate Circular Student ArrangementsAmazon · ONSITE INTERVIEW
  • Inventory Outfit CombinationsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Partition into Equal-Sum GroupsPalo Alto Networks · ONSITE INTERVIEWPalo Alto Networks interview questions
  • Permutations IILinkedIn · PHONE SCREENLinkedIn interview questions
  • Expand Attribute CombinationsPinterest · PHONE SCREENPinterest interview questions
  • Alternating Parity PermutationsGoldman Sachs · OAGoldman Sachs interview questions
  • Winning Draws for a Mahjong HandZip · PHONE SCREENZip interview questions
  • Count Legal Outfit CombinationsDuolingo · OADuolingo interview questions
All Motive interview questionsSee Motive hiring insights
Saved
class Solution {
    public String[] enumerateGridPaths(int rows, int cols) {
      // write your code here
    }
}
Checking account…