about summary refs log tree commit diff
path: root/scratch/facebook/moderate
AgeCommit message (Collapse)AuthorFilesLines
2020-11-16 Solve "find pairs for sum"William Carroll1-0/+19
I have encountered this problem 3x in the wild thus far: 1. www.InterviewCake.com 2. Cracking the Coding Interview 3. www.Pramp.com
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 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.