Skip to content

Instantly share code, notes, and snippets.

View Bovojon's full-sized avatar
💭
Problem first. Tools second.

Jon Bovojon

💭
Problem first. Tools second.
  • Seattle, WA
View GitHub Profile
@Bovojon
Bovojon / members.py
Created October 19, 2017 17:45
Given requests to add users to a group, output a list of the members of each group.
'''
Given requests to add users to a group, output a list of the members of each group.
'''
def listMembers(string_list):
'''
We could automate the creation of a new group that is not in the
alphabetically ordered list of groups yet. However, I believe that is beyond
the scope of what this assignment is asking for.
'''
@Bovojon
Bovojon / browsing_href.py
Created October 19, 2017 17:44
Given a stream of href links, backward operations, or forward operations, output a stream of the full url the browser should visit after each event in the input stream.
'''
Given a stream of href links, backward operations, or forward operations, output
a stream of the full url the browser should visit after each event in the input stream.
'''
def full_url(paths):
'''
In this implementation, I am assuming that a user cannot go backwards more
than once consequentively.
'''
@Bovojon
Bovojon / unique_process_ids.py
Created October 19, 2017 17:43
Given a stream of process ids associated with process start and finish actions, output the one process id which has not yet finished, or 0 if all processes are accounted for.
'''
Given a stream of process ids associated with process start and finish actions,
output the one process id which has not yet finished, or 0 if all processes are
accounted for.
'''
def finished_processes(ids):
'''
It would have been too easy to use the count() method in python - the solution
would have been in a few lines of code only:
@Bovojon
Bovojon / hexadecimal_conversion_colors.py
Last active October 13, 2017 20:47
Zillow University Test on HackerRank - Converting Hexadecimal values to 32-bit integers
'''
Jon
Zillow University Test
'''
def css_string_to_color(colorString):
if (colorString[0]!='#'):
print("Error")
else:
if correctLength(colorString):
@Bovojon
Bovojon / pagination.py
Created October 12, 2017 20:29
Airbnb HackerRank Challenge - Pagination
'''
Jon Abdulloev
'''
def paginate(num, results):
outputResults = sortDecreasing(results)
outputResults, paddingList = makeUnique(outputResults)
remaining = len(outputResults)%num
@Bovojon
Bovojon / histogram.py
Last active April 25, 2022 22:07
Histogram of the top 10 most common words in a text file
import sys
import histogram_main
import time
def remove_punctuation(words):
# Initialize an empty Python dict
histogram = {}
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']