Age | Commit message (Collapse) | Author | Files | Lines |
|
I have encountered this problem 3x in the wild thus far:
1. www.InterviewCake.com
2. Cracking the Coding Interview
3. www.Pramp.com
|
|
After seeing the solution that my book advocated, I implemented it using
recursion.
|
|
Write a random number generator for [0,7) using only a random number generator
for [0,5). Ensure the results are uniformly distributed.
|
|
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.
|
|
Write a function that returns the indices demarcating a substring, which if
sorted, would make the entire array sorted.
|
|
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.
|
|
Write a function that verifies whether or not a tic-tac-toe board is valid.
|