Question: USE PYTHON - The first, fifth, and sixth entries decrease Alex's balance because Alex is a borrower in them. The second and third entries increase
USE PYTHON



- The first, fifth, and sixth entries decrease Alex's balance because Alex is a borrower in them. The second and third entries increase it because Alex is a lender. So, Alex's balance is (2+5)(2+4+4)= 710=3. - Blake is a lender in the first and fifth entries and a borrower in the second and fourth entries. Thus, Blake's balance is (2+4)(2+7)=69=3. - Casey is a lender in the third entry and a borrower in the fourth and sixth entries. Thus, Casey's balance is (7+4)5=6 The answer (in alphabetical order) is ["Alex", Blake"] because both of them have a balance of 3. which is the minimum among all members. 1. Smallest Negative Balance You are working on a new application for recording debts. This program allows users to create groups that show all records of debts between the group members. Given the group debt records (including the borrower name, lender name, and debt amount), who in the group has the smallest negative balance? Notes: - 10 is smaller than 1 - If multiple people have the smallest negative balance, return the list in alphabetical order. - If nobody has a negative balance, return the string "Nobody has a negative balance". Example n=6 debts = ['Alex Blake 2', 'Blake Alex 2', 'Casey Alex 5: 'Blake Casey 7', 'Alex Blake 4: 'Alex Casey 4'] There are 6 debt records, as shown in the table below: Returns string[]: an array of strings denoting an alphabetically ordered list of members with the smallest negative balance, or an array containing the string "Nobody has a negative balance" Constraints - 1n2105 - debts[i][2] represents an integer between 1 and 1000 inclusively. - 1 length of debts[i][O], length of debts[i][1] 20 - The first character of debts[i][0] and debts[i][1] is capital English letter. - Every character of debts[i][j] and debts[i][1] except the first one is lowercase English letter. - debts[i][0] = debts[i][1]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
