PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Optiver

Decide and implement DP/heap and approximation

Last updated: Mar 29, 2026

Quick Overview

This question evaluates dynamic programming for counting constrained subsequences, priority-heap implementation and API robustness for job scheduling, and heuristic approximation methods for NP-hard selection problems, along with algorithmic complexity analysis.

  • Medium
  • Optiver
  • Coding & Algorithms
  • Software Engineer

Decide and implement DP/heap and approximation

Company: Optiver

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

You have 90 minutes to complete three related coding tasks: a) Dynamic programming: Given an integer array nums (n ≤ 2e 5) and a threshold T, design and implement an algorithm to count the number of non-empty subsequences whose sum is at most T; explain why brute force is infeasible, justify your chosen DP or optimized approach, and analyze time and space complexity. b) Heap simulation: Implement a job scheduler that supports up to 2e5 operations over jobs with APIs INSERT(jobId, priority), POP() returning the smallest-priority job with stable tie-breaking, and DECREASE_KEY(jobId, delta); guarantee O(log n) per operation using a binary heap (or equivalent) and handle invalid/duplicate operations robustly. c) Approximate optimization: For selecting k items from n to minimize total score given item weights and pairwise penalties (an NP-hard objective), propose and implement a greedy or simulated-annealing heuristic; specify initialization, temperature/cooling or selection rules, stopping criteria, and how you will evaluate approximation quality versus a baseline.

Quick Answer: This question evaluates dynamic programming for counting constrained subsequences, priority-heap implementation and API robustness for job scheduling, and heuristic approximation methods for NP-hard selection problems, along with algorithmic complexity analysis.

Related Interview Questions

  • Find missing numbers in sequences - Optiver (hard)
  • Design a circular queue data structure - Optiver (medium)
  • Optimize flight and cargo bookings for profit - Optiver (hard)
  • Compare two programs for equivalence - Optiver (Medium)
  • Design a satellite propagation simulator - Optiver (Medium)
Optiver logo
Optiver
Aug 13, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
14
0

You have 90 minutes to complete three related coding tasks: a) Dynamic programming: Given an integer array nums (n ≤ 2e 5) and a threshold T, design and implement an algorithm to count the number of non-empty subsequences whose sum is at most T; explain why brute force is infeasible, justify your chosen DP or optimized approach, and analyze time and space complexity. b) Heap simulation: Implement a job scheduler that supports up to 2e5 operations over jobs with APIs INSERT(jobId, priority), POP() returning the smallest-priority job with stable tie-breaking, and DECREASE_KEY(jobId, delta); guarantee O(log n) per operation using a binary heap (or equivalent) and handle invalid/duplicate operations robustly. c) Approximate optimization: For selecting k items from n to minimize total score given item weights and pairwise penalties (an NP-hard objective), propose and implement a greedy or simulated-annealing heuristic; specify initialization, temperature/cooling or selection rules, stopping criteria, and how you will evaluate approximation quality versus a baseline.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Optiver•More Software Engineer•Optiver Software Engineer•Optiver Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,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.