-
Notifications
You must be signed in to change notification settings - Fork 379
Closed
Labels
Description
LeetCode Username
lakshya0754N
Problem Number, Title, and Link
- Find Users With Valid E-Mails https://leetcode.com/problems/find-users-with-valid-e-mails
Bug Category
Missing test case (Incorrect/Inefficient Code getting accepted because of missing test cases)
Bug Description
The current test cases do not verify that the leetcode
part of the domain is case-sensitive. According to the problem, only @leetcode.com
(all lowercase) is valid. Emails with uppercase letters in leetcode
, e.g., @LeetCode.com
or @LEETCODE.com
, should be considered invalid, but existing test cases do not cover this.
Language Used for Code
MySQL
Code used for Submit/Run operation
SELECT *
FROM Users
WHERE
mail REGEXP '^[a-zA-Z][a-zA-Z0-9_.-]*@.*$'
AND CONVERT(RIGHT(mail, 4) USING utf8mb4) COLLATE utf8mb4_bin = '.com'
AND LOWER(
SUBSTRING(
mail,
INSTR(mail, '@') + 1,
LENGTH(mail) - (INSTR(mail, '@') + 4)
)
) = 'leetcode';
Expected behavior
The solution should only consider emails with the domain exactly @leetcode.com
(all lowercase) as valid. Any email where the leetcode
part contains uppercase letters, such as @LeetCode.com
or @LEETCODE.com
, should be rejected as invalid.
Example:
user_id | name | |
---|---|---|
1 | Winston | winston@LEETCODE.com |
2 | Jonathan | jonathanisgreat |
3 | Annabelle | bella-@leetcode.com |
4 | Sally | sally.come@leetcode.mom |
5 | Marwan | quarz#2020@LEETCOD.com |
6 | David | david69@gmail.com |
7 | Shapiro | .shapo@LEETCODE.Com |
Current Result:
user_id | name | |
---|---|---|
1 | Winston | winston@LEETCODE.com |
3 | Annabelle | bella-@leetcode.com |
Expected Result:
user_id | name | |
---|---|---|
3 | Annabelle | bella-@leetcode.com |