This file contains hidden or 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
# ----Ma version (9.84 µs)---- | |
def longest_streak(elements): | |
counter = 1 | |
acc = [0] | |
previous_element = "" | |
for element in elements: | |
if previous_element == element: | |
counter += 1 |
This file contains hidden or 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
LOWER_CASE_TO_CAPITAL = ord('a') - ord('A') | |
def my_title(title): | |
acc = "" | |
previous_letter = "" | |
for letter in title: | |
if ("a" <= letter <= "z") and not("a" <= previous_letter <= "z") and not("A" <= previous_letter <= "Z"): | |
letter = chr(ord(letter) - LOWER_CASE_TO_CAPITAL) |