# Google SWE Internship 2021 Interview Experience

Hi Geeks, I have applied for Google SWE Internship 2021 (India) and I have been selected and invited for Google’s Online Challenge Round

**Application:** I have applied through LinkedIn, it is really a great platform for opportunities and I received mail from Google on 12 Aug 2020 and it was a great experience for me.

I am here to share questions that have been asked in coding challenges. I hope I will help you.

**Round 1:**

**Question 1: **Array queries: You are given an array of integers whose length is N, you must perform the following five types of query on the given array :

**Left:**Perform one cyclic left rotation.**Right:**Perform one cyclic right rotation.**Update Pos Value:**Update the value at index**Pos**of the array by.**Val****Increment Pos:**Increment value at index**Pos**of the array by 1.**Pos:**Print the current value at index**Pos.**

All the queries are performed considering 1-based indexing.

**Note: **

- One cyclic left rotation changes (
*arr*) to (_{1}, arr_{2}, arr_{3}, . . . , arr_{N-1}, arr_{N}*arr*)._{2}, arr_{3}, . . .arr_{N-1}, arr_{N}, arr_{1} - One cyclic right rotation changes
*(arr*._{1}, arr_{2}, arr_{3}, . . . , arr_{N-1}, arr_{N}) to (arr_{N}, arr_{1}, arr_{2}, arr_{3}, . . .arr_{N-1})

**Input format**

- The first line contains an integer
denoting the length of the array.**N** - The second line contains
space-separated integers denoting the elements of the array.**N** - The third line contains an integer
denoting the number of queries.**Q** - Next,
lines contain the described type of query.**Q**

**Output format: **For each query of type **5**, print the output in a new line.

**Constraints**

2 ≤ N ≤ 5 x 10^{5}2 ≤ Q ≤ 5 x 10^{5}1 ≤ Pos ≤ N 0 ≤ arr≤ 10_{i , }Val^{5}

It is guaranteed that at least one query is of type **5**.

**Sample Input 1**

10 0 3 3 8 0 6 9 3 2 8 10 Increment 3 Increment 1 Left Increment 5 Left ? 9 Right

**Sample Output 1**

1 9

**Question 2:**There are N-words in a dictionary such that each word is of fixed length M and consists of only lowercase English letters that are (*‘a’, ‘b’, ……. ‘z’*).

A query word denoted by Q. The length of query word in M. These words contain lowercase English letters but at some places instead of a letter between ‘a’, ‘b’, ……. ‘z’ there is ‘?’ .Refer to the **Sample input** section to understand this case.

A match count of Q, denoted by **match_count(Q), **is the count of words that are is the dictionary** **and contain the same English letters (excluding a letter that can be in the position of ?) in the same position as the letters are there are in the query word Q.

In other words, a word in the dictionary can contain any letters at the position ‘?’ but the remaining alphabets must match with the query word.

You are given a query word Q and you are required to compute **match_count(Q).**

**Input format**

- First-line contains two space-separated integers
**M**and**N**denoting the number of words in the dictionary and length of each word respectively. - The next
**N**lines contain one word each from the dictionary. - The next line contains an integer
**Q**denoting the number of query words for which u have to compute match_count() - The next
**Q**lines contain one query word each.

**Output format**

For each query word, print** match_count** for specific words in a new line.

**Constraints**

1 ≤ N ≤ 5 x 104 1 ≤ M ≤ 7 1 ≤ Q ≤ 105

**Sample Input **

5 3 cat map bat man pen 4 ?at ma? ?a?

**Sample Output**

2 2 4 2