PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Databricks

Choose the Best Travel Mode

Last updated: Jun 20, 2026

Quick Overview

Solve a grid-based pathfinding problem where a traveler must choose the transportation mode with the lowest travel time and cost tie-breakers. The question evaluates BFS, reachability under mode-specific passability rules, tie-breaking logic, and efficient handling of multiple traversal modes.

  • medium
  • Databricks
  • Coding & Algorithms
  • Software Engineer

Choose the Best Travel Mode

Company: Databricks

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a 2D grid representing a map, a start cell, a destination cell, and several transportation modes. Each mode has a per-step time cost and a per-step monetary cost. A traveler must choose exactly one mode for the entire trip. For a chosen mode, the traveler may move up, down, left, and right through cells that are open for that mode, plus the start and destination cells. Compute which mode reaches the destination with the smallest total travel time. If multiple modes tie on time, choose the one with the smaller total monetary cost. If no mode can reach the destination, return `None`. Design the algorithm so the grid is scanned efficiently instead of running unnecessary repeated work for every direction.

Quick Answer: Solve a grid-based pathfinding problem where a traveler must choose the transportation mode with the lowest travel time and cost tie-breakers. The question evaluates BFS, reachability under mode-specific passability rules, tie-breaking logic, and efficient handling of multiple traversal modes.

Related Interview Questions

  • Implement an Alternating Tic-Tac-Toe Game - Databricks (hard)
  • Implement a Snapshot Set Iterator - Databricks (medium)
  • Find the Best Commute Mode - Databricks (medium)
  • Partition a Target String by Source Substrings - Databricks (medium)
  • Design In-Memory QPS Counter - Databricks (medium)
|Home/Coding & Algorithms/Databricks

Choose the Best Travel Mode

Databricks logo
Databricks
Jun 4, 2026, 12:00 AM
mediumSoftware EngineerTechnical ScreenCoding & Algorithms
1
0
Practice Read
Loading...

You are given a 2D grid representing a map, a start cell, a destination cell, and several transportation modes. Each mode has a per-step time cost and a per-step monetary cost. A traveler must choose exactly one mode for the entire trip. For a chosen mode, the traveler may move up, down, left, and right through cells that are open for that mode, plus the start and destination cells. Compute which mode reaches the destination with the smallest total travel time. If multiple modes tie on time, choose the one with the smaller total monetary cost. If no mode can reach the destination, return None. Design the algorithm so the grid is scanned efficiently instead of running unnecessary repeated work for every direction.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Databricks•More Software Engineer•Databricks Software Engineer•Databricks Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.