Created
April 6, 2022 23:11
-
-
Save aaronshaver/9f810ec8a91db8a203e7a3b5ce3a8304 to your computer and use it in GitHub Desktop.
RegEx finding two different groups, e.g. "13" gets (1,3) and "13#" gets (13#)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://leetcode.com/problems/decrypt-string-from-alphabet-to-integer-mapping/ | |
def freqAlphabets(self, s): | |
return ''.join(chr(int(i[:2]) + 96) for i in re.findall(r'\d\d#|\d', s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment