Company: Fantasy Premier League
Difficulty: medium
Modulo Queries There is an empty container. You want to support 2 types of queries in this container: 1 V X : Insert an element in the container with value V and power equal to X . 2 V 0 : Let N be the number of bits in the binary representation of V without leading zeros. Consider all the elements in the container till now. You need to count the number of elements which when divided by 2 N leaves a remainder equal to V and also find the sum of powers of such numbers. Mathematically, count the number of elements Y such that Y is present in the container and Y mod 2 N = V . For all such Y , you need to find the sum of their powers also. Given Q queries, answer queries of type 2 V 0 . Notes 1-based indexing is followed. Do not consider leading zeros while counting the number of bits in an integer. Function Description Complete the modulo_queries() function. This function takes the following 2 parameters and returns a 2D array/vector containing answers to queries of Type 2: Q : Represents