Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. Loan Discovery Affirm interacts with merchants, users, and financial institutions to provide consumer loans. When a person borrows from us , we keep track

. Loan Discovery Affirm interacts with merchants, users, and financial institutions to provide consumer loans. When a person borrows from us, we keep track of the history of events. In this exercise, we will focus on a shortened history to demonstrate some key features of the type of work we do daily. One of Affirm's product is Anywhere, which allows users to take out an installment loan via virtual card. A user applies for a certain amount of money that gets credited to a credit-like card and purchases can be made up to that amount credited on the card. For instance, a user can apply for $100, get authorized, and have card that has $100 that can be used. Then, the user can buy multiple items that sum up to this amount. The individual items and their sum cannot be larger than this amount. To represent this process, we will utilize the following two events: Authorization (Auth) Event - Before a transaction goes through, this event occurs to ensure that the card has enough funds to continue with a given purchase. Capture Event - A merchant signals that a card has been used for a certain amount and the funds are removed from the card. In this scenario, a card can have multiple capture events. For the purpose of this problem we will make a few assumptions: YVY - year, MM - month, DD - day, HH - hour, MM - minute Auth events will be formatted like [YYYY-MM-DD HH:MM] CARD #CARDNUM AUTH AMOUNT such as [2020-11-0123:58) CARD #98 AUTH 100Capture events will be formatted like [YYYY-MM-DD HH:MM] CAPTURE such as [2020-11-0123:58] CAPTURE 50Our key words ("Card", "Capture", "Auth") aren't necessarily always capitalized. For this purpose, there will always be positive auth amounts. However, there may exist negative captures, which may come from errors in our system or the merchant's system. In those cases, ignore negative sums in your calculations. As part of further safety measures at Affirm, we want to start flagging certain users that we might consider "suspect" or might be misusing our product! Help us find some "suspect" users identified through cards that have the following properties: the card with the most valid capture events in non-active times along with the count of valid capture events in non-active times Any time is considered "non-active" if they fall within the timing (HH:MM) range of 00:00-07:59 or 22:00-23:59.the card that has the largest captured amount denoted as the sum of amounts from positive capture events along with the total amount captured For instance, if there is an auth of 100 and there are 4 captures (-50,101,201,301), then the amount would be 603 since we ignore non-positive captures the card with the most number of negative capture events along with the count of negative capture events Note that a valid capture event is one that is non-negative. We can guarantee that there are no ZERO capture events. The input is not guaranteed to be ordered. Cards /Ds will be positive numbers. You can assume that an ordered history of events will have every single capture to correspond with the most previous auth at that point in time.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions