Loading
Loading
A registration form should treat two display names as the same if they match once you ignore case and every character that is not a letter or a digit.
Return true when the two names collide under that rule.
a = "Ada_Lovelace 01", b = "adalovelace01""Ada_Lovelace 01"strip non-alphanumerics"AdaLovelace01"lowercase"adalovelace01"matches btrueSign in to keep a note here. It is free, and nobody else can see it.
Sign inExample 1
Sign in to open hints.
Struggling is where the learning happens. Open this once you have genuinely tried, or once the hints have run out.
O(n + m) time · O(1) space
Input. Run your code to watch it work on this input, one line at a time.
Running code is turned off on this deployment. You can still read the problem, write code, use hints and the visualizer.
Tab moves focus out of the editor. Press Ctrl+M to let Tab indent instead.
No results yet
Run your code against the sample tests, or submit to run the full suite.
Both normalise to adalovelace01.
Example 2
Spaces and punctuation are ignored.
Example 3