Intuit | Longest repeating pattern of spending
Anonymous User
4446

If you have an input which is having userid and the category of the payments that they made with their credit card given as
UseridList - List<String>
CategoryList - List<List<String>>
find the 2 users with the longest common spending pattern. Return null if none exists.

Eg:

UseridList : {"user1", "user2", "user3", "user4"}
CategoryList: {{"fashion","restaurant","grocery","utility"}, {"fuel","fashion","restaurant","grocery"}, {"fuel","utility","restaurant","grocery"}, {"internet","transportation","water","grocery"}}

Longest repeating sequence is between user1 and user2 which is {"fashion","restaurant","grocery"}.
Output : {"user1","user2"}

Follow up question: Optimal way to get list of users (2 or more) which have the the longest common spending pattern.

Comments (10)