FastPrepMinimum Travel Time With Periodic Fast Roads
Problems/Minimum Travel Time With Periodic Fast Roads

Minimum Travel Time With Periodic Fast Roads

Adobe logoAdobe● HardFULLTIMEOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The source reports a large plane with fast roads at multiples of p, fast travel cost 1, other travel cost k, and all six input values from 1 through 10^9. This practice version authors cost per unit grid step, a coordinate domain of 1 through 10^9, movement directions and the interface.

Travel on the integer grid whose x and y coordinates both range from 1 through 1000000000. Start at (a,b) and finish at (c,d).

You may move one unit horizontally or vertically while staying inside the grid. A horizontal step costs 1 minute when its y coordinate is a multiple of p; otherwise it costs k minutes. A vertical step costs 1 minute when its x coordinate is a multiple of p; otherwise it costs k minutes.

Return the minimum total travel time. Turns and waiting add no extra cost.

Function

minimumRoadTime(p: int, k: int, a: int, b: int, c: int, d: int) → long

Examples

Example 1

p = 3k = 5a = 3b = 1c = 5d = 3return = 4

Move vertically from (3,1) to (3,3) on the fast x=3 road, then horizontally to (5,3) on the fast y=3 road. Four unit steps cost 4, matching the Manhattan-distance lower bound.

Example 2

p = 3k = 10a = 1b = 1c = 2d = 2return = 20

A direct two-step route costs 20. Reaching a fast road first needs at least two ordinary steps costing 20, and still leaves positive travel, so it cannot improve the result.

Constraints

  • 1 <= p, k, a, b, c, d <= 1000000000

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

  • 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
  • Minimum Numeric Code TransformationOA · Seen Aug 2026

Similar questions at other companies

  • Sum Dynamic Weighted Tree DistancesJuspay · OA
  • Minimum Fuel Cost Between CitiesMicrosoft · OAMicrosoft interview questions
  • Drone Delivery with Battery Swap StationsCisco · OACisco interview questions
  • Optimal TransferSuperhuman · OASuperhuman interview questions
  • Find the PathLinkedIn · OALinkedIn interview questions
  • Energy CrisisRubrik · OARubrik interview questions
  • Compute Number of LocationsMoney Forward · OA
  • Best Telescope SiteAtlassian · OAAtlassian interview questions
  • Cheapest Flight with Its PathAirbnb · OA · ONSITE INTERVIEWAirbnb interview questions
  • Traveling the GraphsOptiver · OAOptiver interview questions

Adobe interview experiences

  • 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)
  • Adobe Product Intern Interviews: 15 Experiences (Part 3 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public long minimumRoadTime(int p, int k, int a, int b, int c, int d) {
        // Write your solution here
    }
}
Checking account…