Google | L4 | Seattle | Sep 2019 [No Offer]
Anonymous User
2838

Standard 4 Rounds

Round 1 - Coding (45 mins)

  • https://leetcode.com/problems/logger-rate-limiter/ (premium)
    Finished code in < 10 mins. A lot of time remaining. Disussion regarding doing this for a Stream of messages and other ways to improve the solution for scale.

    My Solution
    class Logger {
    
    	class Node{
    		String message;
    		int timeStamp;
    		Node(String message, int timeStamp) {
    			this.message = message;
    			this.timeStamp = timeStamp;
    		}
    	}
    
    	PriorityQueue<Node> q;
    	Map<String, Node> map;
    
    	/** Initialize your data structure here. */
    	public Logger() {
    		q = new PriorityQueue<>((a,b) -> a.timeStamp - b.timeStamp);
    		map = new HashMap<>();
    	}
    
    	/** Returns true if the message should be printed in the given timestamp, otherwise returns false.
    		If this method returns false, the message will not be printed.
    		The timestamp is in seconds granularity. */
    
    	public boolean shouldPrintMessage(int timestamp, String message) {
    		while(!q.isEmpty() && timestamp - q.peek().timeStamp >= 10) {
    			Node node = q.poll();
    			map.remove(node.message);
    		}
    
    		if(map.containsKey(message)) {
    			return false;
    		} else {
    			Node node = new Node(message, timestamp);
    			map.put(message,  node);
    			q.offer(node);
    			return true;
    		}
    	}
    }
    
    Time : O(log n)
    Space : O(n)
    
    where n is the number of unique messages in given timeframe.

Round 2 - Coding (45 mins)

  • Find object in a grid
    I came up with a approach O(n) for a n*n grid. Spend some time trying to come up with a better approach. Couldn't improve on time complexity. Couldn't find a O(log n) approach.
    Was asked to write the code for the linear approach. I was able to finsh the code with 10 mins remaining for interview. Was asked again to finish the O(log n) approach which I couldn't do.
    It can be a m*n grid, i.e. a rectangle.

Round 3 - Behavioral (45 mins)

  • Very generic questions. Its time to boast. I was underprepared to sell my skills.

Round 4 - System Design (45 mins)

  • 20 mins for various technical questions like SQL VS No SQL
  • 20 mins for designing Satellite imaging system for Google maps.
    Interviewer was too focused on API design and spent entire 20 mins on just API design. I failed pretty bad on that.

Result : No offer. Interviewers din't get enough signals.

Take away :
Programming was under control. To be honest the questions were far too easy than what I expected.
Need more work on designing skills and "Behavioral".

Comments (3)