2019-04-19から1日間の記事一覧

16. storing data log

Problem 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 i-th last e…

43. implementing stack

Problem Implement a stack that has the following method. push(val), which pushes an element onto the stack pop(), which pops off and returns the topmost element of the stack. If there are no elements in the stack, then it should throw an e…