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
import sys | |
# Author: Visalbotr Chan | |
# Date: Aug 14 2020 | |
# sys.stdin = open("test1.txt", "r") | |
def main(): | |
def recursion(stack_ith, plate_needed): | |
# base case | |
if stack_ith >= num_stacks or plate_needed <= 0: |
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 addTwo(val): | |
val += 2 | |
x = 1 | |
addTwo(x) | |
print(x) | |
# Output 1 | |
# Expected 3 |
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
sentence = "i like apple" | |
# Create a dictionary counting character frequency of ``sentence`` | |
# With using default dicionary | |
from collections import defaultdict | |
frequencies = defaultdict(int) | |
for char in sentence: | |
frequencies[char] += 1 | |
# Without using defualt dictionary |