The Google online challenge 2020 for university undergraduates 2021 batch was held on August 22, 2020. Before this round, some shortlisting was done based on your resume.
The test was conducted on HackerEarth platform. The test consisted of two coding questions and the time allotted was 60 minutes. My set of questions are mentioned below.
- First Question: You are given a string S ( having lowercase English letters only). In one operation, you can remove the substring “pr” from the string S and get amount X or you can remove the substring “rp” and get the amount Y.
Find the maximum amount you can get if you perform zero or more such operations optimally.
Note :
- Substring of a string S is defined as a continuous sequence of characters in S.
- After removing “pr” or “rp”, the order of remaining letters should remain the same.
Example:
abppprrr (string S) 5 4 (value of X and Y )
Output:
15
Explanation :
Here, S=”abppprrr”
X= 5, Y=4.
Remove substrings are mentioned :
Remove “pr”, new string S=”abpprr”.
Remove “pr”, new string S=”abpr”.
Remove “pr”, new string S=” “.
In total, we removed pr 3 times, so total score is 3*X + 0*Y = 3*5 =15.
- Second Question: Given an array A of N integers and another array B of M integers (not necessarily distinct). The task is to find the minimum number of elements to be added in B so that A becomes subsequence of B. Note that you can add elements at any position in B.
A subsequence is a sequence that can be derived by deleting some or no elements from the sequence without changing the order of remaining elements.
Example:
5 6 ( size of A array and B array) 1 2 3 4 5 ( A array ) 2 5 6 4 9 12 ( B array )
Output:
3
Explanation: We need to add 3 numbers in B such that A will become subsequence of B.
We added 1 at the start of B and elements 3, 4 between 2 and 5. Now array B becomes [1, 2, 3, 4, 5, 6, 4, 9, 12] and A is a subsequence of B.
Recommended Posts:
- GOCC14: Google's Online Coding Challenge - New Grad (India)
- GOCC18: Google Online Coding Challenge 2020 - New Grad(India)
- Google Internship 2020 - Google Online Challenge(1st Coding Round)
- Google's Online Challenge for 2021 Intern (India) Experience
- GOCC15: Google's Online Challenge for Internship (India)
- GOCC15: Google SWE Online Coding Challenge Internship 2021
- Google Online Challenge 2020
- Google Online Challenge 2020(MCQ)
- Google Interview Onsite (University Grad - 2020)
- Amazon Interview Experience | Set 183 (SDE - New Grad Position)
- Google Online Challenge(MCQ's) Experience
- Google Online Challenge for Summer Internship 2021
- GOCG13: Google's Online Challenge Experience for Business Intern | Singapore
- Google STEP Intern Coding Challenge Experience
- Credit Suisse Interview for Technical Analyst through Global Coding Challenge
- Atlassian Grad SWE Interview Experience | On Campus FTE
- UBS Grad Interview Experience
- MakeMyTrip Interview Experience | Set 5 (Online Coding)
- BrowserStack Interview Experience | Set 7 (Online Coding Questions)
- MakeMyTrip Interview Experience | Set 6 (Online Coding)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


