PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Meta

Find K-th Largest and Longest Vacation

Last updated: Mar 29, 2026

Quick Overview

This pair of problems evaluates array manipulation and algorithmic problem-solving skills, specifically order-statistics for selecting the k-th largest element and maximizing consecutive sequences under constrained transformations for the vacation streak problem.

  • medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Find K-th Largest and Longest Vacation

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Solve the following two coding problems. 1. **Find the k-th largest element** Given an integer array `nums` and an integer `k`, return the element that would appear at index `k` if the array were sorted in **descending** order. Assume `k` is **0-indexed**, so: - `k = 0` means the largest element - `k = 1` means the second largest element - and so on **Example:** - `nums = [5, -3, 9, 1]` - `k = 0` -> `9` - `k = 1` -> `5` - `k = 3` -> `-3` 2. **Maximize the longest vacation using PTO** You are given a calendar year represented as a character array containing only: - `H` = holiday - `W` = workday You are also given an integer `pto`, representing how many workdays you may convert into vacation days by using Personal Time Off. Your goal is to maximize the length of the **longest consecutive vacation streak**, where a vacation day is either: - an existing holiday (`H`), or - a workday (`W`) that you choose to cover with PTO Return the maximum possible length of such a consecutive streak. **Example:** - `calendar = [W, H, H, W, W, H, W]` - `pto = 2` - Output: `5` **Explanation:** By using PTO on two appropriate workdays, you can create a longest contiguous vacation block of length 5.

Quick Answer: This pair of problems evaluates array manipulation and algorithmic problem-solving skills, specifically order-statistics for selecting the k-th largest element and maximizing consecutive sequences under constrained transformations for the vacation streak problem.

Related Interview Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)
Meta logo
Meta
Nov 1, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0

Solve the following two coding problems.

  1. Find the k-th largest element Given an integer array nums and an integer k , return the element that would appear at index k if the array were sorted in descending order. Assume k is 0-indexed , so:
    • k = 0 means the largest element
    • k = 1 means the second largest element
    • and so on
    Example:
    • nums = [5, -3, 9, 1]
    • k = 0 -> 9
    • k = 1 -> 5
    • k = 3 -> -3
  2. Maximize the longest vacation using PTO You are given a calendar year represented as a character array containing only:
    • H = holiday
    • W = workday
    You are also given an integer pto , representing how many workdays you may convert into vacation days by using Personal Time Off. Your goal is to maximize the length of the longest consecutive vacation streak , where a vacation day is either:
    • an existing holiday ( H ), or
    • a workday ( W ) that you choose to cover with PTO
    Return the maximum possible length of such a consecutive streak. Example:
    • calendar = [W, H, H, W, W, H, W]
    • pto = 2
    • Output: 5
    Explanation: By using PTO on two appropriate workdays, you can create a longest contiguous vacation block of length 5.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Software Engineer•Meta Software Engineer•Meta 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
  • Compare Platforms
  • Discord Community

Support

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

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.