Stripe Hackerank OA
Anonymous User
556

The OA had 3 questions and 60 mins timer. Free to choose any language with auto completion and syntax highlighting supported in editor.

You can run custom test cases and there were 20 hidden test cases in total.

Each question build upon the previous one you solved.

Q1: You have to identify customers who are collectively running a payment scam (ring of fraud)

You are given a transaction list Array<String> where items are of form
transactions = [ "A:d1", "B:d2", "C:d3", "D:d2", "B:d3" ], note that each customer can have multiple entries in the transactions list with different device_id as well.

Here B and C belong to same group because they both have device_id = "d3", simillarly B and D are in same group since they have "d2", now since B is in group with C and D, it means {B,C,D} are all in the same group. A is not part of this group since it is using device_id = "d1" which is used by none other customer. So final answer is [ {B, C, D} , {A}]

Q2: You to return the size of largest ring of fraud (number of people in the group), but this time the Array<String> is of following format, transactions = [ "A:d1:123", "B:d2:456", "C:d3:123", "D:d2:789", "E:d2:123"] where we have an additional field credit_card_id

Here the there are two groups operating

  • {A, C} because they all are using same credit_card_id
  • {B, D, E} because they all are using same device_id

The largest ring of fraud is {B, D, E} since they have 3 members

Q3: This was about calculating the risk factor for ring of fraud, so again we have a list of transactions Array<String> where its form is
transactions = [ "A:d1:123:90", "B:d2:456:50", "C:d3:123:0", "D:d2:789:100", "E:d2:123:30"] the new additional field is risk_factor

Here as per previous logic the groups are {A, C} and {B, D, E}
Now for each group we need to find risk factor.

risk_factor for any group {x, y..} = ( x risk factor + y risk factor + ..) / size of group, however if any customer has risk_factor = 0, then we need to remove them from their group.

risk_factor for group {A, C} = 90
risk_factor for group {B, D, E} = 60

So we finally return [90, 60]

Comments (4)