Code Kata Challenge – 3rd Place: Efficiency

BTI360 Blog / July 2, 2014 in 

The Code Kata Challenge has past but today let’s review the code from our 3rd place winner who takes home the first copy of Are You Smart Enough to Work at Google?.

Challenge review:

  • Implement a queue class using 2 stacks internally
  • The queue class should implement an insert and retrieve method
  • The 2 internal stacks should implement push and pop methods

Third place goes to Steve!

While Steve’s solution is clean it also gets extra points for efficiency.

Chris’ honorable mention post took the approach to copy everything in stack 1 (the add/insert stack) over to stack 2 except for the final element in stack 1, which was to be returned from the overall retrieve method, and then copy everything in stack 2 back over to stack 1, for every retrieval (in case another insert operation occurs in between retrievals).

However this isn’t quite necessary, as Steve’s solution and later solutions will show. For the efficiency of the solution, it is awarded third place.

Steve – Great work!

Invitations still available – so join us for Code Kata Night on July 10th from 3-5pm!

Previous

Code Kata Challenge – Honorable Mention: Clean & Tested

Next

Code Kata Challenge – 2nd Place: A Unique Submission

Close Form

Enjoy our Blog?

Then stay up-to-date with our latest posts delivered right to your inbox.

  • This field is for validation purposes and should be left unchanged.

Or catch us on social media

Stay in Touch

Whether we’re honing our craft, hanging out with our team, or volunteering in the community, we invite you to keep tabs on us.

  • This field is for validation purposes and should be left unchanged.