Skip to content

Missing Test Case - 1517. Find Users With Valid E-Mails #32660

@lakshya0754N

Description

@lakshya0754N

LeetCode Username

lakshya0754N

Problem Number, Title, and Link

  1. 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 mail
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 mail
1 Winston winston@LEETCODE.com
3 Annabelle bella-@leetcode.com

Expected Result:

user_id name mail
3 Annabelle bella-@leetcode.com

Screenshots

Wrong answer for given code:
Image

Code accepted by leetcode:
Image

Additional context

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions