Practice Coupon Code Validator
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Coupon i has identifier code[i], category businessLine[i], and activation flag isActive[i]. It is valid only when active, its nonempty identifier contains only English letters, digits, and underscores, and its category is electronics, grocery, pharmacy, or restaurant. Return valid identifiers ordered by those four categories in that order, then lexicographically within each category.
Source: Coupon Code Validator on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
code = ["SAVE20","","PHARMA5","SAVE@20"], businessLine = ["restaurant","grocery","pharmacy","restaurant"], isActive = [true,true,true,true]
["PHARMA5","SAVE20"]
# Example 2
code = ["GROCERY15","ELECTRONICS_50","DISCOUNT10"], businessLine = ["grocery","electronics","invalid"], isActive = [false,true,true]
["ELECTRONICS_50"]
Constraints
Related LeetCode Problems
Practice more problems similar to Coupon Code Validator.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.