Google Interview Question for Software Developers
- 0of 0 votes
Given a string of size n consisting of 0s and/or 1s.you have to perform k queries and there are two types of queries possible.- vejon December 02, 2017 in United States
"1"(without quotes): Print length of the longest substring with all '1'.
"2 X"(without quotes): where X is an Integer between 1 to n.In this query, you will change character at Xth position to '1' (it is possible that the character at ith position was already '1')
First Line of input contains n and k, where n is string length and k is the number of queries.
Next line contains a string of 0's and/or 1's of length n.
Each of next k lines contains query of any one type (i.e 1 or 2).
Output Format: For each query of type 1, print in new line the maximum size of subarray with all 1's.
| Report Duplicate | Flag | PURGE
Google Software Developer
Interview Type: In-Person
Open Chat in New Window