Skip to content

Instantly share code, notes, and snippets.

View OEUG99's full-sized avatar
🌟
Currently coding!

Oli Eugenio OEUG99

🌟
Currently coding!
View GitHub Profile
@OEUG99
OEUG99 / Stairway-Problem-Recursive-Solution.py
Last active October 25, 2021 01:42
A function to calculate the number of different paths up a flight of stairs that has n-steps, if you can only move 1,2,3 steps at a time.
def num_paths(n):
"""
A function to calculate the number of different paths up a flight of stairs that has n-steps, if you can only move
1,2,3 steps at a time.
"""
# Base cases:
if n < 0:
return 0
if n == 1:
@OEUG99
OEUG99 / RecursiveArraySum.py
Created October 21, 2021 01:07
Using recursion to implement mathematical inductive proofs.
def sum(array):
# Base Case:
if len(array) == 1:
return array[0]
# Inductive Step:
return array[0] + sum(array[1:])
print(sum([1,2,3,4,5]))