PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates a candidate's competency in algorithmic problem solving, numerical precision handling, and combinatorial selection under exact equality constraints.

  • medium
  • Airbnb
  • Coding & Algorithms
  • Software Engineer

Determine Exact Layover Booking

Company: Airbnb

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a layover duration `target_hours` and a list of experience durations `durations`, such as `[2.0, 3.6]`, where each number represents the number of hours needed for one bookable experience. You may book any experience **multiple times**. Determine whether it is possible to choose experiences so that their total time **exactly equals** the layover duration. Additional assumptions: - All durations are positive. - Each duration and the target have at most one decimal place. - Exact equality is required. Return `true` if the layover can be filled exactly, otherwise return `false`.

Quick Answer: This question evaluates a candidate's competency in algorithmic problem solving, numerical precision handling, and combinatorial selection under exact equality constraints.

You are given a layover duration `target_hours` and a list of experience durations `durations`, where each value represents the number of hours needed for one bookable experience. You may book any experience multiple times. Determine whether it is possible to choose experiences so that their total time exactly equals the layover duration. All durations are positive, and each duration and the target have at most one decimal place. Return `True` if the layover can be filled exactly, otherwise return `False`.

Constraints

  • 0 <= len(durations) <= 100
  • 0.0 <= target_hours <= 1000.0
  • Each value in durations is positive
  • Each duration and target_hours has at most one digit after the decimal point

Examples

Input: ([2.0, 3.6], 7.2)

Expected Output: True

Explanation: Book the 3.6-hour experience twice to get exactly 7.2 hours.

Input: ([2.5, 4.0], 6.5)

Expected Output: True

Explanation: Book one 2.5-hour experience and one 4.0-hour experience.

Input: ([1.5, 2.0], 4.2)

Expected Output: False

Explanation: Any sum formed from 1.5 and 2.0 hours will be a multiple of 0.5, so 4.2 cannot be reached exactly.

Input: ([], 0.0)

Expected Output: True

Explanation: Choosing no experiences gives a total of 0.0 hours.

Input: ([], 1.0)

Expected Output: False

Explanation: With no available experiences, a positive target cannot be formed.

Input: ([0.5], 2.0)

Expected Output: True

Explanation: Book the 0.5-hour experience four times to reach 2.0 hours.

Hints

  1. This is similar to an unbounded coin change / reachability problem, because each duration can be used more than once.
  2. Avoid floating-point precision issues by converting every value to tenths of an hour before running dynamic programming.
Last updated: Apr 19, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,500+ 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
  • Compare Platforms
  • Discord Community

Support

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

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Count Candies from Unlockable Boxes - Airbnb (medium)
  • Find Optimal Property Combination - Airbnb (medium)
  • Solve Linked-List and Iterator Problems - Airbnb
  • Implement Text Layout and Query Parsing - Airbnb (easy)
  • Parse Query Parameters Into a Map - Airbnb (medium)