Skip to content
This repository was archived by the owner on Jul 18, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions eating_cookies/eating_cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
# The cache parameter is here for if you want to implement
# a solution that is more efficient than the naive
# recursive solution
def eating_cookies(n, cache=None):
pass
def eating_cookies(n):
if n == 0:
return 1
elif n < 1:
return 0
else:
return eating_cookies(n-1) + eating_cookies(n-2) + eating_cookies(n-3)

if __name__ == "__main__":
if len(sys.argv) > 1:
Expand Down
10 changes: 9 additions & 1 deletion making_change/making_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

import sys

total = 0
count = 0
sub_count = 1

def making_change(amount, denominations):
pass
test = [1] + [0] * (amount)
for index in denominations:
for place in range(index, amount +1):
test[place] = test[place] + test[place - index]
return test[amount]


if __name__ == "__main__":
Expand Down
17 changes: 16 additions & 1 deletion recipe_batches/recipe_batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@
import math

def recipe_batches(recipe, ingredients):
pass
batches = -1
no_more_ingredients = False

while no_more_ingredients == False:
batches +=1

for item in recipe:
if item in ingredients.keys():
if recipe[item] <= ingredients[item]:
ingredients[item] -= recipe[item]
else:
no_more_ingredients = True
break


return batches


if __name__ == '__main__':
Expand Down
21 changes: 21 additions & 0 deletions rock_paper_scissors/rps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,29 @@

import sys

def rps_recursion(number, list):
if number == 0:
return number


def rock_paper_scissors(n):
pass
result_array = []
selection = ['rock', 'paper', 'scissors']

def recursive_listing(iterations, result=[]):
if iterations == 0:
return result_array.append(result)
for choice in selection:
recursive_listing(iterations -1, result + [choice])

recursive_listing(n)
return result_array







if __name__ == "__main__":
Expand Down
14 changes: 13 additions & 1 deletion stock_prices/stock_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@
import argparse

def find_max_profit(prices):
pass
max_profit = 0
stored_value = prices[0]
max_profit = prices[1]-prices[0]
index = 2
while True:
if index > len(prices):
break
for price in prices[index-1:]:
if price - stored_value > max_profit:
max_profit = price - stored_value
stored_value=prices[index-1]
index += 1
return max_profit


if __name__ == '__main__':
Expand Down