about summary refs log tree commit diff
path: root/scratch/facebook
AgeCommit message (Collapse)AuthorFilesLines
2020-11-15 Find the intersection (if any) between two linked listsWilliam Carroll1-0/+34
As with most linked list questions, this one involves an arcane trick from the neck-bearded playbook.
2020-11-15 Solve "Move Zeroes to End"William Carroll1-0/+26
Write a function to modify an array of integers in-place such that all of the zeroes in the array are at the end, and the order of the other integers is not changed.
2020-11-14 Include re-roll strategy for rand7William Carroll1-8/+11
After seeing the solution that my book advocated, I implemented it using recursion.
2020-11-14 Solve rand7William Carroll1-0/+22
Write a random number generator for [0,7) using only a random number generator for [0,5). Ensure the results are uniformly distributed.
2020-11-14 Solve unsorted-substring a second timeWilliam Carroll1-5/+51
This solution operates in O(n) time instead of O(n*log(n)) time, which surprisingly isn't *that* big of a difference... Consider a size of n of 10M... 1) ~10s 2) ~0.5s So, yes, the O(n*log(n)) will take 100x longer to complete, but for an enormous input size of 10M elements, it can still complete in under a minute. The difference between that and the second, faster, algorithm, is just 9s.
2020-11-14 Solve unsorted-substringWilliam Carroll1-0/+21
Write a function that returns the indices demarcating a substring, which if sorted, would make the entire array sorted.
2020-11-14 Partially implement a HeapWilliam Carroll1-0/+30
Defining the insert (or "siftup") function described in the "Programming Pearls" book.
2020-11-14 Write encoded XML parser and pretty-printerWilliam Carroll2-0/+135
Write a function that reads a string of compressed XML and outputs the decompressed version. Note to self: Now that I'm growing more comfortable writing parsers, I'd like to become equally comfortable writing pretty-printers.
2020-11-13 Solve tic-tac-toe checkerWilliam Carroll1-0/+99
Write a function that verifies whether or not a tic-tac-toe board is valid.
2020-11-13 Solve box-stacking problemWilliam Carroll1-0/+50
Write a function to compute the highest stack of boxes that can be created from a list of boxes.
2020-11-13 Solve N queensWilliam Carroll1-0/+46
After a five year hiatus, I decided to attempt to solve the famous N queens problem again. This time, instead of modeling the chess board using a `[[Bool]]`, I'm using `[Integer]` where the `Integer` indicates which column has a queen. This is a bit lighter in RAM.
2020-11-13 Document subset of BNF for regex engineWilliam Carroll1-0/+10
Adding some documentation for my future self.
2020-11-12 Add coding exercises for Facebook interviewsWilliam Carroll66-0/+2994
Add attempts at solving coding problems to Briefcase.