Split Daily Settlements Into K Batches Minimizing the Largest

Last updated: November 29, 2026

Quick Overview

Daily card settlement totals must be grouped, in date order, into at most k contiguous batches for transfer to a partner bank. Return the smallest possible value of the largest batch total.

Capital One
Coding & Algorithms
Software Engineer
Capital One
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Daily card settlement totals must be grouped, in date order, into at most k contiguous batches for transfer to a partner bank. Return the smallest possible value of the largest batch total.

Capital One moves settlement funds in batches, and partner limits make the largest single transfer the constraint that matters. This Power Day question tests the binary-search-on-the-answer pattern: recognizing a monotone feasibility check and proving the bounds.

What the Interviewer Expects
  • Identify that feasibility is monotone in the cap
  • Set lo to the largest single day and hi to the total
  • Write a greedy check that counts batches for a cap
  • Binary search to the smallest feasible cap
  • Compare with the O(k n^2) dynamic programming alternative
Key Topics to Cover
Binary search on answer
Greedy feasibility
Array partitioning
Monotonic predicates
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you return the actual batch boundaries?
  • What if each batch also has a maximum number of days?
  • Why does the greedy feasibility check give the minimum number of batches for a fixed cap?
  • How would the approach change if days could be reordered?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • Input: non-negative integers in date order, and k >= 1.
  • Batches are contiguous and every day belongs to exactly one batch.
  • Output: the minimum achievable maximum batch sum....
High-Level Design

Flip the question: given a cap C, can we split into at most k batches with every batch at most C? Greedily extend the current batch until adding the next day would exceed C, then start a new batch. Gr...


Submit Your Answer
Markdown supported