Contribute OA questions
OAHelper
CompaniesProblemsTopicsInterview Experiences
Explore
G

Google

sde

Interview Date

19-08-2026

Result

Selected

Difficulty

Easy

Rounds

01

Drive Type

Off-Campus

Interview Date

19-08-2026

Result

Selected

Difficulty

Easy

Rounds

01

Drive Type

Off-Campus

Topics asked

dsa

Detailed experience

Part 1: Algorithmic Problem — Heaps & K-Way Merge ### Base Problem: Merge k Sorted Lists You are given an array of `k` linked-lists `lists`, each linked-list is sorted in ascending order. Task:** Merge all the linked-lists into one sorted linked-list and return it. If you simply merge the first list into the second, then the result into the third, and so on, the time complexity degrades to $O(k^2 \cdot N)$ (where $N$ is the average length of a list). Why does this sequential merging cause so much redundant work? How do you implement a **Min-Heap (Priority Queue)** to solve this optimally? Explain the process: What exactly are you storing in the heap, and when you pop the minimum element, what is the $O(\log k)$ operation you must perform next? Alternatively, how can you solve this in the exact same $O(N_{total} \log k)$ time complexity using a **Divide and Conquer** approach, strictly avoiding the overhead of a Heap data structure? - ### Follow-Up 1: Find K Pairs with Smallest Sums You are given two integer arrays `nums1` and `nums2` sorted in ascending order and an integer `k`. Task:** Define a pair `(u, v)` which consists of one element from the first array and one element from the second array. Return the `k` pairs with the smallest sums. A brute-force approach generating all possible $M \times N$ pairs and sorting them is too slow. How can you visualize this problem as finding the smallest elements in a conceptual 2D grid, which perfectly maps to the "Merge k Sorted Lists" strategy? When you pop the current smallest pair `(nums1[i], nums2[j])` from your Min-Heap, you must insert the next potential candidates. Do you insert `(i+1, j)` or `(i, j+1)`? How do you prevent inserting the exact same coordinate pair into the heap twice? - ### Follow-Up 2: Trapping Rain Water II (3D Elevation Map) Given an $M \times N$ integer matrix `heightMap` representing the height of each unit cell in a 2D elevation map. Task:** Return the volume of water it can trap after raining. In the 1D version of this problem, you used Two Pointers starting from the left and right edges. In a 2D grid, water can spill out in 4 directions. Why must you initialize your search by pushing the *entire outer perimeter* of the matrix into a **Min-Heap**? Explain the BFS traversal logic: Why is it absolutely critical that you always pop the cell with the *lowest* height from the heap first? When you pop a boundary cell and look at its unvisited inner neighbors, how do you mathematically calculate the trapped water for that neighbor, and what value do you push back into the heap to represent the new "effective boundary"? - ## Part 2: AI & LLM Core Concepts (Very Light / Foundational) ### Question 1: Speculative Decoding LLM generation is often bottlenecked by memory bandwidth (reading the massive model weights into the GPU for every single word). To speed this up, researchers use **Speculative Decoding**. In plain English, how does this technique use a tiny, fast "Draft" model and the massive, slow "Target" model together? How does it generate text 2x-3x faster without losing a single drop of the large model's intelligence? - ### Question 2: Constrained Decoding (Structured Outputs) If a developer needs an AI to return data in a strict JSON format (e.g., `{"name": "string", "age": number}`), asking nicely in the prompt sometimes fails. Modern APIs now offer **Structured Outputs** (or Constrained Decoding). At a mechanical level, how does the inference engine force the AI to write perfect JSON? (Hint: Think about what happens to the probabilities of words like "Sure!" or invalid brackets before the AI is even allowed to pick its next token). - ### Question 3: The ReAct Agent Framework (Reasoning + Acting) When building autonomous AI agents, developers frequently use the **ReAct** pattern. This forces the LLM to output its thoughts in a strict loop: *Thought $\rightarrow$ Action $\rightarrow$ Observation*. What is the practical advantage of forcing the AI to explicitly write down its "Thought" (e.g., "I need to search Wikipedia for X") before it triggers the "Action"? Why not just let it take the action immediately? - ### Question 4: Mixture of Depth (MoD) / Early Exiting We know that "Mixture of Experts" routes complex questions to different horizontal slices of a model. A newer optimization is **Mixture of Depth (MoD)**, sometimes related to "Early Exiting." In simple terms, if an LLM is 80 layers deep, how does MoD save massive amounts of compute power when processing a very simple token (like the word "the") versus a highly complex token (like solving a math equation)?

Posted on - 26 Sept 2026
Company OAsAll ProblemsTopicsCompany InsightsOA CalendarInterview ExperiencesPremium
OAHelper

Built by students, for students - practice company-specific OAs, DSA sheets, and real interview experiences to land your dream role.

© 2026 OAHelper.in·Terms·Privacy·Refunds·Trust & Safety·Contact·
Ready to crack your next OA?

Practice company-specific questions trusted by thousands of students across India.

Start PracticingGo Premium
OA Practice·DSA·Placements

Disclaimer: OAHelper is an independent educational platform. We (oahelper.in) do not own the images or questions shown. Content is uploaded by users.