PaulLockett / CodeSignal_Practice_Industry_Coding_Framework

Practice The CodeSignal Pre-screen for the Industry Coding Framework.
83 stars 23 forks source link

Questions about expected output for level 4 tests #8

Open dsbowen opened 2 weeks ago

dsbowen commented 2 weeks ago

Thanks for posting this repo!

For level 4 tests, the sequence of events is:

  1. upload "Initial.txt" at 12:00
  2. upload "Update1.txt" at 12:05
  3. copy "Update1.txt" to "Update1Copy.txt" at 12:15
  4. upload "Update2.txt" at 12:20
  5. rollback to 12:10
  6. ... file search with prefix "Up" at 12:25
  7. file get "Update2.txt" at 12:25

For 6 and 7, the test cases say the output should be "found at [Update1.txt, Update1Copy.txt, Update2.txt]" and "got at Update2.txt" respectively. But, if the database should be in its 12:10 state and Update1Copy.txt wasn't created until 12:15 and Update2.txt wasn't created until 12:20, why are these appearing in the search results?

If I'm understanding the purpose of rollback correctly, shouldn't the expected outputs be "found at [Update1.txt]" and "file not found"? Thanks for clarifying.

wenxus commented 1 week ago

I think the idea is to use the timestamp in each specific step. So for step 6, search is executed at 12:25, which means all 3 files: Update1.txt, Update1Copy.txt and Update2.txt exist. It's the same for step 7.

This way the server is not stateful, which makes a better design. However, this means rollback have very little effect on the server, so it can be a little confusing.