Leetcode 831. Masking Personal Information
Given a string that's either an email or a phone number, detect which it is and return a masked version: for emails, convert to lowercase and replace the name's middle characters with exactly five asterisks, preserving the first and last letters and the domain; for phone numbers, strip non-digit characters (10–13 digits), treat the last 10 as the local number and format as XXXX for the last four digits with the preceding parts replaced by *** groups and a + followed by 0–3 asterisks for the country code.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.