Location: San Bruno, CA

I recently interviewed with YouTube and want to share my interview experience

Telephonic Screening

• Discussed about the internship project for first 10 mns and the challenges faced
• First question : search in a rotated sorted array
https://leetcode.com/problems/search-in-rotated-sorted-array/
• Second question was a follow-up and interviewer just wanted to see approach (he didn’t ask me to code it). The question was to search in a rotated sorted array “with duplicates”
• Asked to write test cases for my code
• I gave an iterative solution. So, I was asked how will I solve it recursively
• Why did I choose iterative approach over recursive?

On-site Rounds

5 interviews + Lunch

Round #1:

• Given a rectangle with width ‘W’ and height ‘H’, you have to fit a string ‘S’ in it with maximum possible font size
• The font size ranges from 1 to 30
• You are given two APIs getCharacterWidth(char c , int font_size) and getCharacterHeight(int font_size)
• getCharacterWidth(char c , int font_size): returns the width of a character for a particular font size
• getCharacterHeight(int font_size): returns the height of characters for a particular font size

Round #2:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX LUNCH BREAK XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Round #3:

• Brace Expansion
• Given a string, perfrom the brace expansion
• For example,
Input: s = “a{d,c,b}e”
output: {ade , ace , abe}

Round #4:

• Design a sparse vector class having the following methods
• setValue(int index , int value)
• getValue(int index)
• getNumberZeros()

Round #5:

• start(int id , int startTime)
• end(int id , int endTime)
• When a process starts, it calls ‘start’ with process id and start-time. When the same process ends, it calls ‘end’ with process id and end-time.
• Write code which prints the logs of this system sorted by the start-time of processes in the below format
{Process id} started at {start-time} and ended at {end-time}