Customer Signer Screening
Problem statement
You are given customer records customers and signer rules conditions.
Every customer row has the same width. customers[i][0] is a unique customer identifier, and the remaining columns are attributes. A condition has the form [columnIndex, allowedValue1, allowedValue2, ...]. Its decimal columnIndex refers to an attribute column, and the customer satisfies that condition when its value in that column exactly matches at least one listed allowed value.
A customer is a signer only when every condition is satisfied. Comparisons are case-sensitive. If conditions is empty, every customer is a signer.
Return one string per customer in the original input order. Use customerId:SIGNER for a signer and customerId:NOT_SIGNER otherwise.
Function
screenCustomerSigners(customers: String[][], conditions: String[][]) → String[]Examples
Example 1
customers = [["c01","CA","active"],["c02","NY","active"],["c03","CA","paused"]]conditions = [["1","CA"],["2","active"]]return = ["c01:SIGNER","c02:NOT_SIGNER","c03:NOT_SIGNER"]Only c01 has an allowed value in both tested columns. Each customer still receives one output row.
Example 2
customers = [["a","gold","online"],["b","silver","branch"],["c","bronze","online"]]conditions = [["1","gold","silver"],["2","online","branch"]]return = ["a:SIGNER","b:SIGNER","c:NOT_SIGNER"]The first condition accepts two values. Customers a and b satisfy every condition, while c fails the first.
Example 3
customers = [["left","pending"],["right","closed"]]conditions = []return = ["left:SIGNER","right:SIGNER"]With no conditions, every customer satisfies the complete (empty) condition set.
Constraints
1 <= customers.length <= 100000.2 <= customers[i].length <= 20, and every customer row has the same length.- Customer identifiers are unique.
0 <= conditions.length < customers[i].length.- Each condition contains a decimal column index followed by 1 to 20 distinct allowed values.
- Condition column indices are distinct and lie between
1andcustomers[i].length - 1. - Every identifier, attribute, and allowed value contains 1 to 30 ASCII letters, digits, underscores, or hyphens.