Given a 2D array represents the debt records, write a function to find the people with the smallest negative balance.
[“user1”, “user2”, 100]
[“user1”, “user3”, 200]
[“user3”, “user1”, 100]
[“user1”, “user2”, 150]
(borrower | lender | amount)
The balance for user1 is -100 - 200 + 100 = -200.
The balance for user2 is 100 + 150 = 250.
The balance for user3 is 200 - 100 = 100.
Get one-to-one training from Google Facebook engineers
Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.
Customized Private Class
Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.