Given an array arr[] containing N integers and there are Q queries where each query consists of a range [L, R]. The task is to find whether all the elements from the given index range have even frequency or not.
Can Someone give better solution than O(n * q).
Solution given on this link is incorrect.
Example is below:
Input: arr[] = {100, 100, 200, 100}, Q[][] = {{1, 4}, {1, 2}}
Output:
No
Yes
Input: arr[] = {1, 1, 2, 2, 1}, Q[][] = {{1, 5}, {1, 4}, {3, 4}}
Output:
No
Yes
Yes