thecrood / Daily-Coding-Problem-16

Daily Coding Problem Challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Daily-Coding-Problem-16

Daily Coading Problem Challenge

This problem was asked by Twitter.

You run an e-commerce website and want to record the last N order ids in a log. Implement a data structure to accomplish this, with the following API:

  • record(order_id): adds the order_id to the log
  • get_last(i): gets the ith last element from the log. i is guaranteed to be smaller than or equal to N.

You should be as efficient with time and space as possible.

About

Daily Coding Problem Challenge

License:MIT License


Languages

Language:Jupyter Notebook 100.0%