PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Remitly

Compute transfers to balance account debts

Last updated: Jun 15, 2026

Quick Overview

This question evaluates a candidate's ability to convert per-account net balances into a set of transfers, testing algorithmic problem solving, data-structure manipulation, and correctness under conservation invariants in transactional systems.

  • easy
  • Remitly
  • Coding & Algorithms
  • Software Engineer

Compute transfers to balance account debts

Company: Remitly

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

## Problem: Balance accounts by generating transfers You are given a dictionary/map `balances` from `accountId -> netBalance`. - A **positive** balance means the account should **receive** money (is owed money). - A **negative** balance means the account should **pay** money (owes money). - The sum of all balances is guaranteed to be **0**. Produce a list of transfers that will settle all accounts to net 0. ### Output format Return a list of transfers like: - `(fromAccount, toAccount, amount)` where `amount > 0` After applying all transfers: - Every account’s balance becomes exactly `0`. ### Example Input: ```text { A: -5, B: 2, C: 3 } ``` One valid output: ```text [(A, B, 2), (A, C, 3)] ``` ### Notes / constraints - You may return **any** valid set of transfers. - Prefer fewer transfers if possible, but correctness is the priority.

Quick Answer: This question evaluates a candidate's ability to convert per-account net balances into a set of transfers, testing algorithmic problem solving, data-structure manipulation, and correctness under conservation invariants in transactional systems.

Related Interview Questions

  • Solve k-Nearest Places by Latitude/Longitude - Remitly (Medium)
  • Design an Elevator System and Scheduler - Remitly (Medium)
Remitly logo
Remitly
Nov 30, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
3
0

Problem: Balance accounts by generating transfers

You are given a dictionary/map balances from accountId -> netBalance.

  • A positive balance means the account should receive money (is owed money).
  • A negative balance means the account should pay money (owes money).
  • The sum of all balances is guaranteed to be 0 .

Produce a list of transfers that will settle all accounts to net 0.

Output format

Return a list of transfers like:

  • (fromAccount, toAccount, amount) where amount > 0

After applying all transfers:

  • Every account’s balance becomes exactly 0 .

Example

Input:

{ A: -5, B: 2, C: 3 }

One valid output:

[(A, B, 2), (A, C, 3)]

Notes / constraints

  • You may return any valid set of transfers.
  • Prefer fewer transfers if possible, but correctness is the priority.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Remitly•More Software Engineer•Remitly Software Engineer•Remitly 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.