Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

MVP 1 #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

MVP 1 #314

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
18 changes: 17 additions & 1 deletion eating_cookies/eating_cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@
# a solution that is more efficient than the naive
# recursive solution
def eating_cookies(n, cache=None):
pass
total = 0
print(n)
if n < 1:
print('base case: {}'.format(n))
return 1
if n-1 > 0:
print('minus 1: {}'.format(n))
total += (1 + eating_cookies(n-1))
if n-2 > 1:
print('minus 2: {}'.format(n))
total += (1 + eating_cookies(n-2))
if n-3 > 2:
print('minus 3: {}'.format(n))
total += (1 + eating_cookies(n-3))

return total


if __name__ == "__main__":
if len(sys.argv) > 1:
Expand Down
10 changes: 9 additions & 1 deletion recipe_batches/recipe_batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
import math

def recipe_batches(recipe, ingredients):
pass
batch_qty = []
try:
for ing_r in recipe:
batches = ingredients[ing_r]//recipe[ing_r]
batch_qty.append(batches)
except KeyError as ke:
return 0

return min(batch_qty)


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

def find_max_profit(prices):
pass
current_mindex = 0

for i in range(0, len(prices)-1):
if prices[i] < prices[current_mindex]:
current_mindex = i

return (max(prices[current_mindex+1:]) - prices[current_mindex])



if __name__ == '__main__':
Expand Down