Interview Question

Country: United States

Comment hidden because of low score. Click to expand.
of 0 vote

Three core ideas since the create/delete/update relies on structure of start/commit/discard

1) When startTransaction is started, operate on a copy of the table then set or discard depending on commit/discard has been called

2) When startTransaction is started, queue up the operations, then only apply the operations if commit has been called else discard the operations

3) Have each operation have commit/discard feature. Each create operation keeps the rowName previous state before modifying the table. If commit is called, it discards the previous rowState and keeps the applied changes. Else if discard is called, it reapplies the prevRow state to the table. The higherLevel class would call commit/discard on each operations. Need to keep track of what operations has been applied.

- tnutty2k8 August 03, 2017 | Flag Reply

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More