PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in date and calendar arithmetic, handling set-based exclusions (holiday lists), and reasoning about algorithmic efficiency for counting working days across potentially large ranges.

  • medium
  • Airtable
  • Coding & Algorithms
  • Software Engineer

Count business days excluding holidays

Company: Airtable

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem: Count Working Days Between Two Dates Given a start date, an end date (inclusive), and a set of holiday dates, compute the number of **working days**. A working day is a date that: - is **not** Saturday or Sunday, and - is **not** in the provided holiday set. ### Input - `startDate`: string in `YYYY-MM-DD` - `endDate`: string in `YYYY-MM-DD` (guaranteed `endDate >= startDate`) - `holidays`: list of distinct date strings in `YYYY-MM-DD` ### Output - An integer: number of working days in `[startDate, endDate]`. ### Example - `startDate = 2026-12-24` - `endDate = 2026-12-28` - `holidays = [2026-12-25]` Dates: - 12/24 Thu (work) - 12/25 Fri (holiday, not work) - 12/26 Sat (weekend) - 12/27 Sun (weekend) - 12/28 Mon (work) Output: `2` ### Constraints (typical) - Date range length up to \(10^6\) days for a naive iteration; design an approach appropriate to the stated constraints. - Holiday count up to \(10^5\).

Quick Answer: This question evaluates proficiency in date and calendar arithmetic, handling set-based exclusions (holiday lists), and reasoning about algorithmic efficiency for counting working days across potentially large ranges.

Count weekdays in the inclusive date range excluding listed holiday dates. Dates use YYYY-MM-DD.

Constraints

  • endDate >= startDate
  • Holiday strings are distinct but are deduplicated defensively

Examples

Input: ('2026-12-24', '2026-12-28', ['2026-12-25'])

Expected Output: 2

Input: ('2026-06-27', '2026-06-28', [])

Expected Output: 0

Input: ('2026-06-22', '2026-06-26', ['2026-06-22', '2026-06-28'])

Expected Output: 4

Hints

  1. Count full weeks in O(1), then handle the remainder and holidays.
Last updated: Jun 27, 2026

Loading coding console...

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
  • 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

  • Implement undo/redo with two stacks - Airtable (medium)
  • Implement spreadsheet undo/redo operations - Airtable (medium)
  • Implement BFS serializer and deserializer - Airtable (Medium)