FastPrepCalendar Availability for at Least P People
Problems/Calendar Availability for at Least P People

Calendar Availability for at Least P People

Google logoGoogle● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks first for times when all people are free. Then it asks for times when at least P people are free, and for an X-day consecutive period. Here the calendar is a true-or-false grid of person by day, and you return every start day that works. Our version is about 88% the same as the reported question.

A binary matrix available has one row per person and one column per day. available[i][d] = 1 when person i is available on day d, and 0 otherwise.

Given p and x, return every starting day of an x-day consecutive period during which at least p people are available on every day of the period. The available people may differ from day to day. Only the number available on each day matters.

Return start indices in increasing order.

Function

availablePeriods(available: int[][], p: int, x: int) → int[]

Examples

Example 1

available = [[1,1,0,1],[1,1,1,1],[0,1,1,1]]p = 2x = 2return = [0,1,2]

Daily counts are [2,3,2,3], so every length-two period starting at 0, 1, or 2 meets the threshold.

Example 2

available = [[1,0],[1,1]]p = 2x = 1return = [0]

Only day 0 has both people available.

Example 3

available = []p = 0x = 1return = []

With no people, the calendar has no represented days.

Constraints

  • 0 <= people <= 2000.
  • All rows have the same day count and people * days <= 2,000,000.
  • 0 <= p <= people and 1 <= x.

More Google Onsite Interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Minimum Swaps to Group Ones in a SquareAmazon · PHONE SCREEN
  • Centered K-by-K Submatrix SumsCitadel · ONSITE INTERVIEW
  • Restaurant Delivery HeatmapDoorDash · ONSITE INTERVIEW
  • Alien Defense Turret PlacementBloomberg LP · ONSITE INTERVIEW
  • Matrix Region SumRippling · OA · ONSITE INTERVIEW
  • Subarray with a Given SumExpedia · ONSITE INTERVIEW
  • Valid Max PoolingNVIDIA · ONSITE INTERVIEW
  • Shortest Subarray with Sum at Least KOracle · ONSITE INTERVIEW
  • Prefix Matrix Products and AutogradOpenAI · PHONE SCREEN · ONSITE INTERVIEW
  • Number of Submatrices That Sum to TargetWhatNot · ONSITE INTERVIEW

Interview reports that mention this question

  • Google PhD Applied ML New Grad Onsite: 1 Experience

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
See Google hiring insights
Saved
class Solution {
    public int[] availablePeriods(int[][] available, int p, int x) {
        // Write your code here.
    }
}
Checking account…