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
# numeral symbol mapping | |
symbols = { | |
1:"I", | |
5:"V", | |
10:"X", | |
50:"L", | |
100:"C", | |
500:"D", | |
1000:"M" | |
} |
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
def maximal_palindrome(s: str) -> str: | |
""" | |
Given a string of letters, find the maximum length possible palindrome | |
Parameters | |
---------- | |
s : str | |
input string of letters, e.g. "abaacc" | |
Returns |
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
from typing import List | |
def word_count(board: List[List[str]], word: str) -> int: | |
"""For a given 2-dimensional 'board' of characters, represented by a list of lists, calculate | |
the number of times a given word appears in the board, either horizontally, vertically, or diagonally | |
(left-to-right) | |
Parameters | |
---------- |