Back to problems

Find the K-th Highest Debit

Algorithm · Oracle · Medium

You are developing analytics for a peer-to-peer lending service. Every loan is logged as a triplet [ , , ]. Both borrower and lender are non-empty strings, and amount is a string that holds a non-negative integer. For any person, define their net debt as the total they borrowed minus the total they lent. A positive net debt signals an overall obligation to pay. Given the list transactions and an integer k, return the k-th largest distinct positive net debt among all…

Checking your access…