Meta Hackercup Practice D2 problem

Revision en1, by Ashwanth.K, 2024-09-24 11:43:54

Problem D2: Line of Delivery (Part 2) Solution

Hello All, I would Like to discuss the problem D2 in recent Meta Hackercup Practice Round of 2024. This problem's solution says we can use treap datastructure to support the operations mentioned in the problem.
Operation 1) Insert a stone at $$$E_i^{th}$$$ empty position.
Operation 2) Move all stones to the left of inserted stone by 1 unit in negative direction.

Yes treaps can be used to solve this problem, But I have come up with a simple vectors approach to solve this.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en8 English Ashwanth.K 2024-09-24 21:02:45 109
en7 English Ashwanth.K 2024-09-24 21:00:32 1004 Tiny change: ' \n\nExample: ' -> ' \n\n#### Example: '
en6 English Ashwanth.K 2024-09-24 14:23:13 3 Tiny change: ') `empty_places[star' -> ') `emptyPlaces[star'
en5 English Ashwanth.K 2024-09-24 13:02:09 1 Tiny change: '[start + E_i - 1]++;`' -> '[start + Ei - 1]++;`'
en4 English Ashwanth.K 2024-09-24 12:18:05 402 (published)
en3 English Ashwanth.K 2024-09-24 12:14:07 143
en2 English Ashwanth.K 2024-09-24 12:07:18 2990
en1 English Ashwanth.K 2024-09-24 11:43:54 696 Initial revision (saved to drafts)