Contribute OA questions
OAHelper
CompaniesProblemsTopicsInterview Experiences
Explore
G

Google

sde

Interview Date

19-08-2026

Result

Selected

Difficulty

Medium

Rounds

02

Drive Type

Off-Campus

Interview Date

19-08-2026

Result

Selected

Difficulty

Medium

Rounds

02

Drive Type

Off-Campus

Topics asked

dsa

Detailed experience

Part 1: Algorithmic Problem — Advanced Trees (LCA & Binary Lifting) ### Base Problem: Lowest Common Ancestor of a Binary Tree Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. The LCA is defined between two nodes `p` and `q` as the lowest node in `T` that has both `p` and `q` as descendants (where we allow a node to be a descendant of itself). Why does a naive Top-Down approach (where you search the entire left and right subtrees of every node for `p` and `q`) degrade to an inefficient $O(N^2)$ time complexity in a worst-case skewed tree? How do you implement a strictly $O(N)$ Bottom-Up Depth-First Search (DFS) that bubbles up a node pointer? Walk through the specific pointer merge logic at the current node: If both `left_result` and `right_result` are non-null, what does this mathematically prove about the current node? If exactly one result is non-null, why is it safe to immediately return that non-null pointer up to the parent without further checks? - ### Follow-Up 1: Lowest Common Ancestor of a Binary Tree III You are given two nodes in a tree, but you are **not** given a pointer to the `root` of the tree. Instead, each node contains an extra pointer to its `parent`. Find the LCA. Structurally, how does having `parent` pointers completely convert this from a standard Binary Tree traversal problem into the classic **"Intersection of Two Linked Lists"** problem? While a naive approach uses an $O(N)$ Hash Set to trace the first node's path upward to the root, how do you optimize the space complexity to strictly $O(1)$? Explain the elegant Two-Pointer cycle trick: When pointer `A` reaches the absolute root (a `null` parent), you instantly reassign it to start at the original `node_B`. Why does this mathematical manipulation guarantee that both pointers will traverse the exact same total distance and physically collide at the exact LCA node? - ### Follow-Up 2: Kth Ancestor of a Tree Node (Binary Lifting) You are given a tree with `n` nodes numbered from `0` to `n - 1`. You are given an integer array `parent` where `parent[i]` is the parent of node `i`. The root of the tree is node `0`. Task:** Implement the function `getKthAncestor(int node, int k)` to return the $k$-th ancestor of the given node. If there is no such ancestor, return `-1`. A standard `while` loop walking up the parent pointers $K$ times results in an $O(K)$ query time, which is too slow for competitive programming environments with 50,000 queries. What is the **Binary Lifting** pattern, and how does it reduce the query time to strictly $O(\log K)$? Explain how to construct the 2D Dynamic Programming matrix `up[node][j]`. What does this specific cell conceptually store regarding powers of 2? Walk through the core DP transition formula: `up[node][j] = up[ up[node][j-1] ][j-1]`. Why does mathematically jumping up $2^{j-1}$ steps, and then jumping *another* $2^{j-1}$ steps from that new position, perfectly equal a single massive jump of $2^j$ steps? When answering the query `getKthAncestor(node, k)`, how do you use bitwise operations on the binary representation of `k` (e.g., $k = 11$, which is $1011_2$ in binary) to resolve the query instantly by combining exactly three matrix lookups? - ## Part 2: AI & LLM Core Concepts (Very Light / Foundational) ### Question 1: Ring Attention (Infinite Context Scaling) Transformer architectures have historically been heavily bottlenecked by GPU VRAM limits as context windows grow. To solve this, researchers developed **Ring Attention** to scale to millions of tokens. Conceptually, how does Ring Attention distribute the mathematical calculations across a "ring" of multiple GPUs so that no single GPU has to store the entire book in its memory at once? - ### Question 2: The Generator-Verifier Pattern (Test-Time Compute) As of 2025 and 2026, models dominating complex reasoning benchmarks utilize heavy "Test-Time Compute" rather than just predicting the next token linearly. A core architecture for this is the **Generator-Verifier** loop. In plain English, what is the conceptual difference in responsibility between the Generator model and the Verifier model? Why is this loop capable of solving math problems that a single massive LLM usually fails on the first try? - ### Question 3: Continuous Batching (Inference Orchestration) When hundreds of users talk to an AI API simultaneously, the inference server must bundle their requests to keep the GPU busy. Historically, servers used "Static Batching," waiting for all users in a batch to finish generating before starting the next batch. Modern AI servers use **Continuous Batching**. How does this technique dynamically swap individual users in and out of the GPU at the exact moment their specific sentence finishes, saving massive amounts of idle compute time? - ### Question 4: KV Cache Eviction (Heavy Hitters) To save memory during incredibly long conversations, inference engines use KV Cache Eviction techniques to delete older tokens from the GPU's memory. However, deleting tokens randomly destroys the model's coherence. What is the concept of a **"Heavy Hitter"** token in the KV cache? Why can an AI safely delete the mathematical memory of generic filler words (like "the" or "and") from a previous paragraph, while deleting a single comma or an attention-dense proper noun completely breaks the attention mechanism?

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.