注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
沒在地理看過 前些時間面的 最後Onsite沒過
"""
You are working on an accounting program for an event's ticketing system.
At the end of the day, all the payments received from the payment gateway have to be matched with the users who bought the tickets. There is always a 1-to-1 match between the users and the payments.
Write a function that, given the payment, pricing, and user data, returns a data structure that links the names of the users to their payment IDs, based on the rules described below.
First, orders can be match by the users' emails. If the emails don't match, use the payment amounts. For each payment amount, there will be at most one payment that cannot be matched via the email.
For this problem, we can assume the names are unique.
Users:
---------------------------------------------------------
| Name | Email |gt; Mike E. # The amount matches, 1 FourEco ticket at 4
1 -> John A. # John's amount matches, being the only payment for 33 with 3 Top tickets at 11
2 -> Michelle X. # It's the only payment for 60 without a matching email
4 -> James S. # James because it's the only other payment for 8
11 -> Albert K. # It's the only other payment for 5 without a matching email
Complexity variables:
U = number of users or payments
T = number ticket prices
""" |