FastPrepLongest Fruit Path
Problems/Longest Fruit Path

Longest Fruit Path

Adobe logoAdobe● HardFULLTIMEOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report identifies a DFS/backtracking task to find the longest path of fruits. It does not give the topology or movement rules. This practice version authors a small binary grid, four-neighbor movement, no revisits, arbitrary endpoints, count output and bounds.

A rectangular orchard is represented by grid. A 1 is a cell containing one fruit, and a 0 is a blocked cell.

Start at any fruit cell. Move up, down, left or right to another fruit cell, and never visit the same cell twice. You may stop at any time.

Return the maximum number of fruits that one path can collect, including its starting cell. Return 0 if there is no fruit.

Function

longestFruitPath(grid: int[][]) → int

Examples

Example 1

grid = [[1,1],[0,1]]return = 3
grid
01011101

Start at (0,0), then visit (0,1) and (1,1). This collects all three fruits once.

Example 2

grid = [[1,0,1]]return = 1
grid
0120101

The blocked middle cell separates the two fruits, so a path collects only one.

Constraints

  • 1 <= grid.length <= 4
  • 1 <= grid[i].length <= 4
  • 0 <= grid[i][j] <= 1
  • Every row has the same length.

Source note: Screenshots of public Reddit comments describing the reported Adobe OA task and any included author clarification. The practice version adds the details stated in the source note.

More Adobe Online Assessment questions

  • Base Unit ConversionsOA · Seen Nov 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Top-Funded Villages and ProjectsOA · Seen Aug 2026
  • Count Parent Nodes With a Target SumOA · Seen Aug 2026
  • Largest Binary Number by ConcatenationOA · Seen Aug 2026
  • Count Events by CategoryOA · Seen Aug 2026
  • Graph M-ColoringOA · Seen Aug 2026
  • Hall of Shifting TilesOA · Seen Aug 2026
  • K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
  • Maze ReachabilityOA · Seen Aug 2026

Similar questions at other companies

  • Empty ShelfSquarepoint Capital · OASquarepoint Capital interview questions
  • Longest Anchored Song ChainIntuit · OAIntuit interview questions
  • Beautiful Number OrderingsDocuSign · OADocuSign interview questions
  • All Palindrome PartitionsExpedia · OAExpedia interview questions
  • Optimal Account BalancingAmazon · ONSITE INTERVIEW
  • Balanced Parentheses with Sequential Left DeletionsGoogle · PHONE SCREENGoogle interview questions
  • Count and Score Distinct Hat AssignmentsRoblox · ONSITE INTERVIEWRoblox interview questions
  • Partition a Card Deck into FifteensMeta · ONSITE INTERVIEWMeta interview questions
  • Word Break IIWex · PHONE SCREEN
  • Maximum Currency Conversion Along a Simple PathRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions

Adobe interview experiences

  • Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public int longestFruitPath(int[][] grid) {
        // Write your solution here
    }
}
Checking account…