Cross-Day User Trust Scores
Problem statement
A lending service records loan-related activity for two consecutive days. Parallel arrays users, days, and loanTypes describe each log entry.
A user earns 50 trust-score points when they appear on both days, and another 50 points when they have at least two distinct loan types across the complete log. Duplicate entries do not increase either signal.
For each name in queryUsers, return its trust-score percentage in the same order. A user absent from the log has score 0.
Function
calculateTrustScores(users: String[], days: int[], loanTypes: String[], queryUsers: String[]) → int[]Examples
Example 1
users = ["ana","ana","bob","bob","cara"]days = [1,2,1,1,2]loanTypes = ["personal","auto","card","home","personal"]queryUsers = ["ana","bob","cara","dave"]return = [100,50,0,0]Ana appears on both days and has two loan types. Bob has two loan types but appears only on day 1. Cara satisfies neither signal, and Dave has no entries.
Example 2
users = ["x","x","x","y","y"]days = [1,1,2,1,2]loanTypes = ["card","card","card","auto","auto"]queryUsers = ["x","y"]return = [50,50]Both users appear on both days, but repeated entries for one loan type still count as only one distinct type.
Constraints
1 <= users.length == days.length == loanTypes.length <= 200000.1 <= queryUsers.length <= 200000.days[i]is either1or2.- User and loan-type strings contain 1 to 40 lowercase English letters.
- The total number of characters across all strings is at most
2,000,000.