This is a video editorial on the May 17 Long Challenge held at Codechef on the Gotham PD problem. We use a persistent trie data structure to solve for additions and queries efficiently.
Jatin Yadav, who is one of India's top competitive programmers, explains the concept of persistent tries and how we implement the same to hit O(N*B) time complexity for this problem.
Problem Statement:
https://www.codechef.com/MAY17/problems/GPD
Trie:
https://youtu.be/YG6iX28hmd0
Persistent Segment Tree:
https://youtu.be/TH9n_HVkjQM
Code:
https://www.codechef.com/viewsolution/13567354