PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates understanding of data structures—particularly priority queues/heaps—and techniques for efficiently handling global/bulk updates and minimum extraction under changing offsets.

  • easy
  • Confluent
  • Coding & Algorithms
  • Software Engineer

Process pod logs with global increments and pop-min

Company: Confluent

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

You are given an event log for a system of “pods.” Each event is a pair `[status, value]`: - `status == 1`: Add a new pod with **initial load** = `value`. - `status == 2`: Increase the load of **every existing pod** by `value` (a global increment). - `status == 3`: Remove the pod with the **smallest current load** and **output/record** that pod’s current load. (For `status == 3`, the `value` field can be ignored.) Return a list of the loads produced by every `status == 3` operation, in order. ### Example Input: `logs = [[1, 5], [1, 2], [2, 3], [3, 0], [3, 0]]` Process: - add pod(5) - add pod(2) - +3 to all ⇒ loads become (8, 5) - pop min ⇒ output 5 - pop min ⇒ output 8 Output: `[5, 8]` ### Notes / assumptions - It is guaranteed that a `status == 3` event will not occur when there are no pods. - Use 64-bit integers if needed. - Aim for an efficient solution (e.g., better than O(n) per global increment).

Quick Answer: This question evaluates understanding of data structures—particularly priority queues/heaps—and techniques for efficiently handling global/bulk updates and minimum extraction under changing offsets.

Process pod loads: add inserts a load, inc changes every active load, and pop removes the smallest current load. Return pop outputs; empty pop returns None.

Constraints

  • Inputs are provided as Python literals compatible with the function signature.
  • Return a deterministic value exactly matching the requested output.

Examples

Input: ([['add', 5], ['add', 2], ['inc', 3], ['pop'], ['add', 1], ['pop'], ['pop']],)

Expected Output: [5, 1, 8]

Explanation: Global increment then pops.

Input: ([['pop'], ['add', 4], ['inc', -1], ['pop']],)

Expected Output: [None, 3]

Explanation: Empty pop and negative increment.

Input: ([['add', 10], ['add', 10], ['inc', 5], ['pop'], ['pop']],)

Expected Output: [15, 15]

Explanation: Ties.

Hints

  1. Start with a direct data structure representation.
  2. Handle edge cases before the main loop.
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 Tail and Find Monster Cost - Confluent (medium)
  • Solve Signature, File, and Queue Problems - Confluent (medium)
  • Implement File Tail and Sensor Health - Confluent (medium)
  • Rank songs by pairwise user preferences - Confluent (medium)
  • Implement tail N lines - Confluent (Medium)