🖥️
Sunil Notebook
Interview Preparation
  • 📒Notebook
    • What is this about ?
  • System Design
    • 💡Key Concepts
      • 🌐Scalability
      • 🌐Latency Vs Throughput
      • 🌐Databases
      • 🌐CAP Theorem
      • 🌐ACID Transactions
      • 🌐Rate limiting
      • 🌐API Design
      • 🌐Strong Vs eventual consistency
      • 🌐Distributed tracing
      • 🌐Synchronous Vs asynchronous Communication
      • 🌐Batch Processing Vs Stream Processing
      • 🌐Fault Tolerance
    • 💎Building Blocks
      • 🔹Message
      • 🔹Cache
      • 🔹Load Balancer Vs API Gateway
    • 🖥️Introduction to system design
    • ⏱️Step By Step Guide
    • ♨️Emerging Technologies in System Design
    • ☑️System design component checklist
      • 🔷Azure
      • 🔶AWS
      • ♦️Google Cloud
    • 🧊LinkedIn feed Design
    • 🏏Scalable Emoji Broadcasting System - Hotstar
    • 💲UPI Payment System Design
    • 📈Stock Broker System Design - Groww
    • 🧑‍🤝‍🧑Designing Instagram's Collaborative Content Creation - Close Friends Only
    • 🌳Vending Machines - Over the air Systems
    • Reference Links
  • DSA
    • Topics
      • Introduction
      • Algorithm analysis
        • Asymptotic Notation
        • Memory
      • Sorting
        • Selection Sort
        • Insertion Sort
        • Merge Sort
        • Quick Sort
        • Quick'3 Sort
        • Shell Sort
        • Shuffle sort
        • Heap Sort
        • Arrays.sort()
        • Key Points
        • Problems
          • Reorder Log files
      • Stacks and Queues
        • Stack Implementations
        • Queue Implementations
        • Priority Queues
        • Problems
          • Dijkstra's two-stack algorithm
      • Binary Search Tree
        • Left Leaning Red Black Tree
          • Java Implementations
        • 2-3 Tree
          • Search Operation - 2-3 Tree
          • Insert Operation - 2-3 Tree
        • Geometric Applications of BST
      • B-Tree
      • Graphs
        • Undirected Graphs
        • Directed Graphs
        • Topological Sort
      • Union Find
        • Dynamic Connectivity
        • Quick Find - Eager Approach
        • Quick Find - Lazy Approach
        • Defects
        • Weighted Quick Union
        • Quick Union + path comparison
        • Amortized Analysis
      • Convex Hull
      • Binary Heaps and Priority Queue
      • Hash Table vs Binary Search Trees
  • Concurrency and Multithreading
    • Introduction
    • Visibility Problem
    • Interview Questions
    • References
      • System design
  • Design Patterns
    • ℹ️Introduction
    • 💠Classification of patterns
    • 1️⃣Structural Design Patterns
      • Adapter Design Pattern
      • Bridge Design Pattern
      • Composite Design Pattern
      • Decorator Design Pattern
      • Facade Design Pattern
      • Flyweight Design Pattern
      • Private Class Data Design Pattern
      • Proxy Design Pattern
    • 2️⃣Behavioral Design Patterns
      • Chain Of Responsibility
      • Command Design Pattern
      • Interpreter Design Pattern
      • Iterator Design Pattern
      • Mediator Design Pattern
      • Memento Design Pattern
      • Null Object Design Pattern
      • Observer Design Pattern
      • State Design Pattern
      • Strategy Design Pattern
      • Template Design Pattern
    • 3️⃣Creational Design Patterns
      • Abstract Factory Design Pattern
      • Builder Design Pattern
      • Factory Method Design Pattern
      • Object Pool Design Pattern
      • Prototype Design Pattern
      • Singleton Design Pattern
    • Java Pass by Value or Pass by Reference
  • Designing Data-Intensive Applications - O'Reilly
    • Read Me
    • 1️⃣Reliable, Scalable, and Maintainable Applications
      • Reliability
      • Scalability
      • Maintainability
      • References
    • 2️⃣Data Models and Query Languages
      • Read me
      • References
    • Miscellaneous
  • Preparation Manual
    • Disclaimer
    • What is it all about?
    • About a bunch of links
    • Before you start preparing
    • Algorithms and Coding
    • Concurrency and Multithreading
    • Programming Language and Fundementals
    • Best Practices and Experience
  • Web Applications
    • Typescript Guidelines
  • Research Papers
    • Research Papers
      • Real-Time Data Infrastructure at Uber
      • Scaling Memcache at Facebook
  • Interview Questions
    • Important links for preparation
    • Google Interview Questions
      • L4
        • Phone Interview Questions
      • L3
        • Interview Questions
      • Phone Screen Questions
  • Miscellaneous
    • 90 Days Preparation Schedule
    • My Preparation for Tech Giants
    • Top Product Based Companies
  • Links
    • Github
    • LinkedIn
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Interview Questions
  2. Google Interview Questions
  3. L3

Interview Questions

PreviousL3NextPhone Screen Questions

Last updated 11 months ago

Was this helpful?

  • I was asked to get all the possible combinations of a series of "musical notes" given the following rules:

    1. Every sequence must have a sum of 12

    2. Possible notes that make up the sequence can only be 1, 2 and 3

    3. There are only certain valid transitions, they're given in this dictionary {1: [2, 3], 2: [1, 2], 3: [1]}. Meaning, only 2 and 3 are allowed after 1 and so on

    4. First note and last note must have a valid transition. Example of valid sequence: [1, 2, 2, 2, 1, 1, 3]. Example of not valid: [1, 2, 2, 2, 2, 2, 1] reason is because 1 cannot be followed by another 1 (last and first notes transition is invalid)

    Return every possible valid sequence in an array of possible sequences. You may return it in any order. ()

  • Write a function that takes the following 3 queries:

    	1. manager, a, b      -> represents that a is manager of b
    	2. peer, a, b         -> both a and b have the same manager
    	3. is_manager a, b    -> you should return whether a is manager of b

    Assume every input is valid. Assume every query is coming one at a time, not a list of queries. Interviewer said I might come across a case where a peer query came with two managerless employees

    My answer was a class that had three global variables: managerless_people, peer_to_manager, managers that represented a connection between a and b. Lots of if statements and assignments. ()

  • Given a string with any format containing only english letters, replace every percent-sign-sorrounded word (%EXAMPLE%) with the corresponding variable given inside a dictionary passed as an argument. Example:

    input = "home/usr/lib/%EXAMPLE%", {EXAMPLE: "testfile.tx"}
    output =  "home/usr/lib/testfile.txt"
    
    input = "Hi %USER% how are you doing today %DATE%?", {USER: "John", DATE: "01/01/2024"}
    output =  "Hi John how are you doing today 01/01/2024?"

    My response was a simple algorithm that goes through every letter and whenever I see % I would call another function to get the closing sign. If no closing sign was found or no variable was mapped to that variable name, I would return error

    Follow Up Question:

    Imagine your dictionary with variables had nested variables. For example:

    input = "Hi %USER%", {USER: "%PRONOUN% John", PRONOUN: "Mr."}

  • Given an array of size n and an integer k where k << n. Also for each element, the absolute difference b/w its current position and sorted position is <= k. We have to sort the array.

  • You are given a tree node (Root) at start. Write two methods a. addNode(TreeNode *parent, int val) ===> Create a new node and add it to its parent. Parent pointer was given as argument for this function. b. getRandomNode() ==> Gives a random node from the tree

    Follow up: getRandomLeafNode() => Give a random leaf node.

    All the methods must be in O(1).

  • Given an array, any subarray is special if it forms an AP with common difference of 1 or -1. Give sum of all such subarrays.

    Ex: arr = [2,3,4,5,6,5]

    So ans should be sum of all the good subarrays which are:

    [2], [3], [4], [5], [6], [5]

    [2,3], [3,4], [4,5], [5,6], [6,5]

    [2,3,4], [3,4,5], [4,5,6]

    [2,3,4,5], [3,4,5,6]

    [2,3,4,5,6]

Link
Link
Page cover image