MLE: Google Preliminary

Posted
28 Apr 2025
334 reads

Summary

I attended a preliminary interview at Google and was presented with a problem to group elements based on common properties.

How it went

Questions was we have n elements with 3 properties each we need to group the elements. If any one of the property is common those two element should be in same group.

e.g.:

elements = {
            "e1": ['red',   'circle',    'small'],
            "e2": ['blue',  'square',    'small'],
            "e3": ['green', 'triangle',  'large'],
            "e4": ['black',   'triangle',  'large'],            
            }
Output: [["e1", "e2"], ["e3", "e4"]]

Questions asked (1)

  1. 01

    Group Elements by Common Properties

    Data Structures & Algorithms

    We have n elements with 3 properties each. We need to group the elements. If any one of the property is common, those two elements should be in the same group.

    e.g.:

    elements = {
                "e1": ['red',   'circle',    'small'],
                "e2": ['blue',  'square',    'small'],
                "e3": ['green', 'triangle',  'large'],
                "e4": ['black',   'triangle',  'large'],            
                }
    
    Output: [["e1", "e2"], ["e3", "e4"]]
    

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Google recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!