Open In App

Google Online Challenge for Summer Internship 2021

The Google online challenge 2020 for summer internships 2021 was held on Sept 26. It was a 60-minute online test having 2 questions to code.

First Question: You are given an array A with N integers. you are required to answer Q queries of the following types.



Determine the count of distinct prime numbers which divides all the numbers in a given range L to R. NOTE:1 based Indexing.

1 <=N,Q<= 10^5;



1 <= A[i] <= 10^5;

1 <= L <= R <= N

Input: 

No of test cases
Array size i.e N
N array elements
No of Queries i.e Q
Q queries

Output: Return count of distinct prime numbers which divides all the numbers in a given range for each query

Sample Input:  

1
6
4 6 3 18 36 54
3
1 2
3 6
4 6

Sample output:

1
1
2

I do not remember the second question exactly. But It was also based on arrays. Prepare for query-based array questions, MO’s algorithm, Segment tree(if possible) standard questions like range sum queries, update range queries, etc.

Article Tags :