Hey.
Thanks for engaging, but I can't help with the most important of those
questions - the large data sets on which my solution failed due to
timeout are hidden from candidates. Not unreasonable to assume that they
do exercise deep stacks, and large args to add_to_first_n, etc.
Yes, the inp
Algorithms questions are always fun. Quick time to answer before other
people!
You might be hitting problems with the "amortized part" if their code
didn't run for large enough n or used dumb special cases or bounds. They
may have (inadvertantly?) meant "realtime constant" (python lists
occasional
On 7 June 2017 at 18:50, Jonathan Hartley wrote:
> Ah. In writing this out, I have begun to suspect that my slicing of 'tokens'
> to produce 'args' in the dispatch is needlessly wasting time. Not much, but
> some.
To put some numbers out there, eliminating the slice is not always a
win. On Python
Do you have any more context?
For example, is the add_to_first_n likely to be called with very large
numbers, or very often? Does the stack get very deep, or stay shallow?
I'm assuming that lines look like this:
push 1
push 2
add_to_first_n 2 10
pop
pop
with all arguments as integers, and the fi
I recently submitted a solution to a coding challenge, in an employment
context. One of the questions was to model a simple stack. I wrote a
solution which appended and popped from the end of a list. This worked,
but failed with timeouts on their last few automated tests with large
(hidden) dat