The system should support adding users with gift cards, making payments using one or more gift cards, and returning aggregated gift card data for a user.
A user can use multiple gift cards in a single payment.
void addUser(String userId, List<String> giftCards)
giftCards is of the form "giftCardId,balance".userId and Each giftCardId is non-blank, globally unique, and contain only characters from [a-z0-9].addUser() is called with an existing userId, ignore the call.boolean addPayment(String userId, List<String> giftCardsUsed)
giftCardsUsed is of the form "giftCardId,amountUsed".false if:
userId is blank or does not exist,giftCardId does not belong to that user, ortrue otherwise.List<String> aggregateGiftCardData(String userId)
giftCardId comes first."giftCardId,balance".userId is blank, return an empty list.1 ≤ userId.length() ≤ 500 ≤ number of gift cards for a user ≤ 1001 ≤ giftCardId.length() ≤ 500 ≤ balance ≤ 10000000 ≤ amountUsed ≤ 1000000addUser(userId = "u1", giftCards = ["gc1,100", "gc2,40", "gc3,100"])
addPayment(userId = "u1", giftCardsUsed = ["gc1,25", "gc2,10"])
trueaggregateGiftCardData(userId = "u1")
["gc3,100", "gc1,75", "gc2,30"]addUser(userId = "u2", giftCards = ["gc5,20"])
addPayment(userId = "u2", giftCardsUsed = ["gc5,25"])
falseaggregateGiftCardData(userId = "u2")
["gc5,20"]addPayment(userId = "u9", giftCardsUsed = ["gc1,10"])
falseaggregateGiftCardData(userId = "u9")
[]addUser(userId = "u3", giftCards = [])
aggregateGiftCardData(userId = "u3")
[]