The tough question for me and the reason I couldn’t get selected (I think that’s the reason) Given an array with numbers in it, you will have n number of queries, each query will have 3 inputs x, y, val where x and y represents the start and end indices of a subarray whose all elements must be increased by a value ‘val’ and then there would be n queries again where each query will have x and y where each query must be returned with the sum of the subarray [x index to y index] of the updated array. At first glance, everyone would say that just add every
time a query has been sent but then there would be no point of asking. So, I said I would use union and intersection of the indices and somehow get to the answer and so he asked how to find union and intersection and that’s where I toppled and couldn’t answer and that’s it they said ok and I left.
After an hour, the results came and they didn’t select anyone from IT profile 🙁
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
Related Practice Problems
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!