Contribute OA questions
OAHelper
CompaniesProblemsTopicsInterview Experiences
Explore
G

Google

SDE

Interview Date

15-08-2026

Result

Rejected

Difficulty

Hard

Rounds

01

Drive Type

Off-Campus

Interview Date

15-08-2026

Result

Rejected

Difficulty

Hard

Rounds

01

Drive Type

Off-Campus

Topics asked

DSA

Detailed experience

The interviewer opened with an advanced algebraic routing and flow decomposition challenge: "Given an arbitrary directed multigraph G with n vertices, m edges, and positive integer capacities bounded by U, compute a polynomial-time decomposition of a given feasible circulation f into cycle flows, but with the strict constraint that you must extract a set of at most m directed cycles such that the maximum flow routed along any single cycle is maximized, or compute the Exact Cycle Flow Decomposition with the Minimum Number of Non-Zero Cycles in polynomial time." I recognized that finding the minimum number of directed cycles whose sum equals a given flow is NP-hard (by reduction from 3-Partition or Subset Sum). However, decomposing f into at most m positive cycles is solvable in polynomial time, and extracting the canonical maximum-weight circulation basis corresponds to a Matroid Base in the cycle space. The interviewer followed up: "Standard DFS extracts cycles in O(m * n) or O(m^2) total time by chasing back-edges; show how Link-Cut Trees accelerate cycle cancellation to O(m log n) time, and how this links to Goldberg-Rao binary length functions." I explained that to decompose a non-zero circulation f into at most m elementary directed cycles, we maintain the positive flow network inside a Link-Cut Tree (Sleator-Tarjan). Every directed edge (u, v) with f(u, v) > 0 is treated as a link. We repeatedly pick an active edge (u, v). By querying the Link-Cut Tree, we test whether v can reach u. If there is a tree path from v to u, adding (u, v) closes a directed cycle C. We query the tree in O(log n) time to find the bottleneck flow capacity delta = min_{e in C} f(e). We then apply a lazy decrement of delta along the tree path, decrement f(u, v) by delta, and for every edge whose residual flow drops to 0, we cut it from the Link-Cut Tree in O(log n) time. Since every cycle extraction either cancels at least one edge completely or saturates the current search, this decomposes the entire circulation into at most m elementary directed cycles in strict O(m log n) time and O(n + m) space. He then shifted to a computational geometry and visibility scenario in algebraic surfaces: "Given n non-vertical triangles in 3D space, determine whether their depth order contains a cycle (meaning triangle A is above B, B is above C, and C is above A from a viewpoint at z = +infinity) in sub-quadratic time, and if no cycle exists, compute an exact Topological Depth Ordering in O(n^(4/3 + epsilon)) time without constructing the full O(n^2) pairwise occlusion graph." I pointed out that testing all pairs of triangles for mutual overlap takes O(n^2), but by the Chazelle-Edelsbrunner-Guibas-Sharir theorem, the cycle-free depth ordering on triangles corresponds to topological sorting of a planar arrangement of piecewise linear envelopes. I proposed using Multi-Level Simplicial Partition Trees over Dual Plücker Coordinates paired with Clipped Cylindrical Algebraic Decomposition. The interviewer cut in: "Two triangles A and B have an above/below relationship if and only if their 2D projections onto the xy-plane intersect, and at the intersection point, the z-coordinate of A is strictly greater than the z-coordinate of B; how does a partition tree locate mutual crossings without evaluating non-overlapping pairs?" I explained that the above/below relation is evaluated by checking segment intersections in the xy-projection. For a triangle A, its boundary consists of three line segments. A cycle occurs if there exists an overlapping topological knot in the projection. Instead of building the full O(n^2) visibility graph, we build a 2-level range query structure: Level 1 indexes the 2D projected boundaries of all triangles using a Matoušek Simplicial Partition Tree to isolate the O(n^(4/3)) candidate pairs whose xy-projections actually overlap. For each candidate pair (A, B) whose projections intersect at an internal segment or vertex, Level 2 evaluates the 3D plane equations z_A(x, y) - z_B(x, y) = 0 at the intersection point in O(1) time. This populates only the active topological dependency edges. If the active dependency graph contains a directed cycle, an occlusion cycle is reported immediately via Kahn's algorithm or Tarjan's SCC in O(V + E) time. If acyclic, topological sort outputs a valid painter's rendering order in strict O(n^(4/3 + epsilon)) deterministic time and O(n) space. For the final challenge, he introduced an algebraic combinatorial string structure on two-dimensional text arrays: "Given an arbitrary string s of length n, compute its Abelian Periodicity Spectrum—specifically, find all integers p such that s can be partitioned into contiguous substrings of length p (with a possible shorter trailing suffix) where every full block is an anagram (Abelian equivalent) of the first block—in O(n log log n) or O(n * sqrt(n)) time." I noted that testing a single period p naively by comparing character histograms across all n/p blocks takes O((n/p) * |Sigma|), which sums to O(n * |Sigma| * log n) across all possible periods, becoming prohibitive for large alphabets or when alphabet size scales with n. I proposed using Multi-Dimensional Parikh Vector Characterization with Bit-Parallel Word Packing and Difference Filtering. The interviewer challenged me: "Two blocks are Abelian equivalent if and only if their Parikh count vectors match identically; walk me through how you verify candidate periods p in O(n/p) time without inspecting all |Sigma| characters in every block, and how prefix sum arrays accelerate the scan." I broke down the algebraic verification: let P(i) be the |Sigma|-dimensional prefix count vector where P(i)[c] counts occurrences of character c in prefix s[0...i-1]. A block of length p spanning [k*p, (k+1)*p - 1] is an anagram of the base block [0, p - 1] if and only if P((k+1)*p) - P(k*p) == P(p). Instead of checking all characters individually, we observe that the difference vector sum_{c} |(P((k+1)*p)[c] - P(k*p)[c]) - P(p)[c]| equals 0 if and only if all character frequencies match identically. We compress character frequencies into 64-bit integer words: each character's count is allocated ceil(log_2(n)) bits within a packed machine word. The subtraction of two packed Parikh vectors and comparison against the base block vector is evaluated using bitwise masking, shifts, and SIMD instructions in O(|Sigma| / (64 / log n)) = O(1) amortized machine operations per block. Furthermore, using a candidate filter: a necessary condition for p to be an Abelian period is that the total frequency of any individual character c in s must be compatible with its count in the first block (cnt_c(s) >= floor(n/p) * P(p)[c]). Checking this necessary scalar bound for the most frequent and least frequent characters prunes over 90% of invalid candidate periods in O(1) time. Testing the remaining candidates across all divisors and step sizes resolves the full Abelian periodicity spectrum in strict O(n log log n) time and O(n) space.

Posted on - 25 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.