Google | OA | invited (2020) | EMEA
Anonymous User
1193

Hello, just thought to share my Google Online Assesment. I did not apply for any jobs at Google, however I recieved at invitation link because I am participators in one of Google's summer programs. I have been told that this OA won't affect furture applications at Google (so I hope so since I am planning to apply for an internship this summer)

Time: 60 Mins
Questions: 2

Question 1 was extremely hard for me, when I switched to question 2 in the back of mind I was still thinking of how I am going to approach Question 1, so I ended up not doing well on either, even though Question 2 was doable. I interviewed before last year with Facebook , Bloomberg and Apple I have never seen such hard questions. They seem to merge more than one solving technique in a single question.

Please if you have any insights how to approach either problem write them down.
Questions 1:
The minimum difference

N boxes are arranged in a line. Each box is colored either with white or black.You can select any number of the box from starting and put it behind the last box in the same sequence as it was plated initially. You can perform this operation at most once.

For example, string S = “wbbb". In one operation, you can select “wb" from the start and put it behind the last box ‘b’. Now, the string becomes “bbwb"
Note: You cannot select all the N boxes.
You are required to determine the minimum number of boxes whose color must be reversed so that all boxes in the sequence are of an alternate color, that is, any two adjacent boxes are of different color.
Input format
• The first line contains the number of test cases(T).
• For each test case, the first line of each test case contains a string S consisting of only two characters ‘w ‘ and ‘b’, represents a white-colored box and 'b. represents a black-colored box.
Output format
Print the minimum number of boxes whose color must be reversed so that all box. in The output must be printed in a new line.

Examples:
WWB —> OUTPUT =0 (since no need to reverse any colts by moving it can be WBW)
WWWB —> OUTPUT=1 (must at least reverse the color of 1 box to have alternating boxes )
BWWW —> OUTPUT=1
BBBWWW—>OUTPUT=2

Question 2:
Find the maximum absolute subarray sum :
Example [4, -6, 2, -7, 5, 4] --> Output is :11 (since subarray -6,2,-7 if added the absolute sum is 11)

Comments (4)