First part of the question same as https://www.1point3acres.com/interview/thread/1180593
Part 2 was different:
--------------------------------------------------
Part 2: Begin/Commit/Abort
--------------------------------------------------
Add support for begin, commit and abort cart operations.
begin(): Starts an operation of adding or removing things t