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
from functools import reduce | |
def baseball_game_func(ops): | |
res = [] | |
for elm in ops: | |
if elm.lstrip('-+').isdigit(): | |
res.append(int(elm)) | |
elif elm == "+": |
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
def compareObjs(obj_1, obj_2): | |
if (type(obj_1) == dict and type(obj_2) == dict): | |
if len(obj_1) == len(obj_2): | |
for key in obj_1: | |
if key in obj_2 and obj_1[key] == obj_2[key]: | |
return compareObjs(obj_1[key], obj_2[key]) | |
else: |
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
Legend | |
| symbol | used for | | |
|=============|=====================| | |
| - | command description | | |
| # | comments | | |
| $ | actual command | | |
| [] | command's output | | |
| <> | command's arguments | |