Skip to content

Practice Find Users With Valid E-Mails

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1517
LeetCode Problem

Find Users With Valid E-Mails

Problem Statement

Tables: Users(user_id INT, name VARCHAR, mail VARCHAR). Users.user_id is unique. Return all columns for users whose mail has a valid prefix and the exact lowercase domain @leetcode.com. The prefix starts with an English letter; later characters may be letters, digits, underscore, period or hyphen. Reject other characters or a differently cased domain. Output order is unrestricted.

Source: Find Users With Valid E-Mails on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Users table: +---------+-----------+-------------------------+ | user_id | name      | mail                    | +---------+-----------+-------------------------+ | 1       | Winston   | winston@leetcode.com    | | 2       | Jonathan  | jonathanisgreat         | | 3       | Annabelle | bella-@leetcode.com     | | 4       | Sally     | sally.come@leetcode.com | | 5       | Marwan    | quarz#2020@leetcode.com | | 6       | David     | david69@gmail.com       | | 7       | Shapiro   | .shapo@leetcode.com     | +---------+-----------+-------------------------+
Output
+---------+-----------+-------------------------+ | user_id | name      | mail                    | +---------+-----------+-------------------------+ | 1       | Winston   | winston@leetcode.com    | | 3       | Annabelle | bella-@leetcode.com     | | 4       | Sally     | sally.come@leetcode.com | +---------+-----------+-------------------------+

Related LeetCode Problems

Practice more problems similar to Find Users With Valid E-Mails.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.