You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 theorder_id
to the logget_last(i)
: gets theith
last element from the log.i
is guaranteed to be smaller than or equal toN
.You should be as efficient with time and space as possible.
The text was updated successfully, but these errors were encountered: