Skip to content

Instantly share code, notes, and snippets.

@vrat28
Created May 24, 2021 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrat28/ab594c333b3e4a51f14a4eac43b804b6 to your computer and use it in GitHub Desktop.
Save vrat28/ab594c333b3e4a51f14a4eac43b804b6 to your computer and use it in GitHub Desktop.
To Lower case
class Solution:
def toLowerCase(self, str: str) -> str:
is_upper = lambda x : 'A' <= x <= 'Z'
to_lower = lambda x : chr(ord(x) | 32)
return ''.join([to_lower(x) if is_upper(x) else x for x in str])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment