Open In App

Google Interview Experience for Internship (Coding Round)

Last Updated : 16 Oct, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

Google Internship (North America) coding round was held between 28th August to 5th September 2020 by Google(NA) for Software Engineering students of Pre-final and final year. The level of this Coding Round was easy.  The coding round comprised of two questions which are as follows :

Question 1: Most Booked Hotel Room

Problem Description: Given a hotel which has 10 floors [0-9] and each floor has 26 rooms [A-Z]. You are given a sequence of rooms, where + suggests the room is booked, – the room is freed. You have to find the number of rooms that were booked.

You may assume that the list describes a correct sequence of bookings in chronological order; that is, only free rooms can be booked, and only booked rooms can be freed. 

You may assume:

  • N (length of input) is an integer within the range [1, 600]
  • Each element of array A is a string consisting of three characters: “+” or “-“; a digit “0”-“9”; and uppercase English letter “A” – “Z”

Example:

Input: ["+1A", "+3E", "-1A", "+4F", "+1A", "-3E"]
Output: 4
Explanation: 4 rooms are booked at this time.
Input: ["-1C", "-3F", "-1L", "-ZF", "-1R", "-3E"]
Output: 0
Explanation: All rooms are free.

Question 2: Maximum Time

Problem Description: You are given a string that represents time in the format HH: MM. Some digits are blank (represented by ?). Fill in? With the same digit such that the time represented by this string is the maximum possible.

 Maximum time: 23:59, minimum time: 00:00. You can assume that the input string is always valid.

Example :

Input: "?4:5?"
Output: "14:51"
Input: "23:5?"
Output: "23:59"
Input: "0?:??"
Output: "05:55"
Input: "??:??"
Output: "22:22"

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads