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 / cat.pl
Last active March 29, 2023 07:27
Cat CLI written in perl, but as one line of code.
#perl program simialr to cat, get input from user via Standar Input, and then print.
print foreach eval qw(<STDIN>); exit 0;
@OEUG99
OEUG99 / Recursive-Anagram-Generator.py
Last active October 23, 2021 04:08
A recursive function that generates a list of all possible anagrams for a given string.
def anagram_generator(string):
"""
A recursive function that generates a list of all possible anagrams for a given string.
"""
list = []
# The last char in our string will be inserted at every index in order to generate sub-anagrams.
insert_char = string[len(string)-1]
# Base Case: if string is only 1 character.
if len(string) <= 1:
@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]))