Minimize Intercompany Settlement Payments Across Group Entities

Last updated: November 29, 2026

Quick Overview

A corporate group has many intercompany balances between legal entities. Compute the minimum number of payments needed to settle every entity's net position, and return one settlement plan achieving it.

PwC
Coding & Algorithms
Software Engineer
PwC
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


A corporate group has many intercompany balances between legal entities. Compute the minimum number of payments needed to settle every entity's net position, and return one settlement plan achieving it.

Intercompany netting and eliminations come up constantly in PwC consolidation, treasury and tax advisory engagements, where fewer cross-border payments mean lower fees and fewer transfer pricing documents. The onsite problem checks whether a candidate sees past the greedy heuristic to the zero-sum subset structure and can implement a bitmask DP.

What the Interviewer Expects
  • Reduce raw balances to one net position per entity
  • Recognize that a zero-sum group of k entities settles in exactly k minus 1 payments
  • Maximize the number of disjoint zero-sum groups with a subset DP
  • Reconstruct an actual payment plan, not just the count
  • State the exponential complexity and when it is acceptable
Key Topics to Cover
Bitmask DP
Subset sums
Graph netting
Greedy counterexamples
Intercompany accounting
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
  • Why does pairing the largest debtor with the largest creditor not always give the minimum?
  • How would you scale this to 500 entities where exact search is infeasible?
  • How would you add a constraint that some entity pairs cannot transact due to currency controls?
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: (payer, payee, amount_cents) balances. Output: the minimum count of payments and a list of (from, to, amount) that zeroes every entity. Entities with zero net position can be ignored. Amoun...

High-Level Design

Net everything first: each entity has one signed balance, summing to zero overall. Any group of kk entities whose balances sum to zero can always be cleared with k−1k - 1 payments (chain debtors to cr...


Submit Your Answer
Markdown supported

Related Questions