SDE
Interview Date
17-08-2026
Result
Rejected
Difficulty
Medium
Rounds
01
Drive Type
Off-Campus
Topics asked
Detailed experience
The interviewer opened with an advanced algebraic graph theory and lattice topology challenge: "Given a connected, undirected multigraph G with n vertices and m edges with a designated sink vertex s, compute the complete rotor-router state recurrence (the Sandpile to Chip-Firing Abelian Group Isomorphism) and determine the exact number of recurrent configurations of the Sandpile Model Jac(G), constructing the identity element of Jac(G) in O(n^3) time without simulating avalanches." I explained that simulating grain additions until stabilizing the identity configuration can take an exponential or pseudo-polynomial number of firings. I proposed computing the critical identity through the Reduced Graph Laplacian via Dhar's Burning Algorithm and Integer Matrix Linear Algebra. The interviewer followed up: "The identity element of the sandpile group Jac(G) is a recurrent configuration e such that for any recurrent configuration c, (c + e)^circ = c; walk me through how the vector 2*u - (2*u)^circ relates to the nullspace of the reduced Laplacian, and how solving a single bounded Diophantine linear system gives the exact identity." I explained that let u be the maximal stable configuration where each vertex v != s has u(v) = deg(v) - 1. We consider the configuration 2 * u. While 2 * u is unstable, its toppling closure (2 * u)^circ is guaranteed to be recurrent. The identity element is given explicitly by the firing formula e = (2 * u - (2 * u)^circ)^circ. However, to evaluate this without simulating millions of toppling events, we observe that the difference Delta = 2 * u - (2 * u)^circ represents the total out-degree firing vector f times the reduced Laplacian: L_red * f = 2 * u - (2 * u)^circ. Because L_red is a symmetric, strictly diagonally dominant M-matrix with all positive diagonal entries and non-positive off-diagonal entries, L_red is invertible over the rationals. We compute L_red^(-1) in O(n^3) time using Cholesky or Gaussian elimination. Finding the exact integer firing vector f amounts to solving L_red * f = Delta, which provides the precise number of times each vertex must fire to reach the unique recurrent representative in the coset Z^(n-1) / Im(L_red). To verify recurrence in O(n + m) time, we run Dhar’s Burning Algorithm: we connect an external fire source to the sink s and let it propagate to vertex v only when the number of burned neighbors exceeds the chips present at v. If all vertices burn, the identity is certified, solving the problem in strict O(n^3) time and O(n^2) space. He then shifted to an online computational geometry and kinetic dynamic partition problem: "Given an arbitrary simple polygon P with n vertices and an interior agent holding a 360-degree point light source, compute the Minimum Number of Reflections (Specular Billiard Trajectory / Link Visibility) required for a light ray starting at point s to illuminate target point t, or construct the Visibility Polygon from an arbitrary segment in optimal O(n) time." I pointed out that constructing visibility polygons from a point is solvable in O(n) via Joe-Simpson's stack sweep, but weak visibility from an entire segment or bounding link paths between two internal points requires handling complex non-local reflex pockets. I proposed using the Shortest Path Tree inside a Constrained Triangulation combined with Guibas-Hershberger's Window Tree / Link Distance decomposition. The interviewer cut in: "Walk me through how the polygon is partitioned into link-distance regions (visicells) by advancing chord windows, and explain why the link distance between s and t is equal to the number of inflection steps in the shortest path's bounding funnel." I broke down the geometric reduction: first, we compute a constrained Delaunay triangulation of P in O(n) time. The visibility polygon from the starting point s forms a 0-link region bounded by polygon edges and a set of internal chords called 'windows'. Each window w is collinear with an internal reflex vertex and spans across an unvisited pocket of P. To compute the 1-link region, each window w acts as an independent linear light source illuminating the adjacent pocket. The locus of points visible from window w forms a trapezoidal/triangular fan whose boundary creates the next tier of windows (windows of link-distance 2). By projecting these windows outward along the dual tree of the triangulation, windows advance monotonically into reflex pockets. Crucially, the minimum link distance between s and t corresponds to the number of bends in a minimum-link path, which is directly bounded by the number of alternating inflection tangents along the geodesic shortest path connecting s and t in the funnel algorithm. Because each edge of the triangulation is crossed by at most one primary window front, the window tree is constructed in strict O(n) time, enabling link-distance and specular ray reflection queries to be evaluated in O(log n) time per query. For the final challenge, he introduced an algebraic combinatorics and string grammar problem on run-length repetitions: "Given an arbitrary string s of length n, find the number of distinct Lyndon Substrings (substrings that are strictly smaller lexicographically than all their non-trivial cyclic rotations) in O(n) deterministic time and O(alphabet) space, without generating the O(n^2) substring set." I noted that testing each substring for the Lyndon property naively using Duval's algorithm takes O(n^3) time, while querying a Suffix Automaton or Suffix Tree requires identifying which implicit nodes correspond to Lyndon words. I proposed using the Duval Lyndon Factorization combined with the Inverse Suffix Array and LCP Array via Crochemore's Lyndon Tree. The interviewer challenged me: "A word w is Lyndon if and only if it is lexicographically strictly smaller than all its proper suffixes. Walk me through how the Lyndon Tree represents the hierarchical factorization of s, and how linear-time Lyndon array construction counts distinct valid substrings without duplicate equivalence classes." I explained that every string has a unique decomposition s = w_1 w_2 ... w_k into a non-increasing sequence of Lyndon words w_1 >= w_2 >= ... >= w_k. To count all distinct Lyndon substrings across the entire string, we build the Lyndon Array L of s, where L[i] is the length of the longest Lyndon prefix of the suffix s[i...n]. By the Hohlweg-Reutenauer theorem, a substring s[i...j] is a Lyndon word if and only if it can be formed by the standard concatenation of two smaller Lyndon words u and v where u < v. This recursive structure forms a binary tree over the positions of s called the Lyndon Tree. We construct the Lyndon Array in O(n) deterministic time using Baier's algorithm or via the Suffix Array and Next Smaller Value (NSV) queries: a suffix s[i...n] is smaller than s[j...n] if and only if SA_inv[i] < SA_inv[j]. In this dual ranking, L[i] is simply the distance to the next position j > i where SA_inv[j] < SA_inv[i], which is computed in a single pass using a monotonic stack in O(n) time. Each node in the resulting Lyndon tree corresponds to a Lyndon substring of s. To eliminate duplicates and count only distinct Lyndon words, we filter out substrings whose occurrences have identical locus in the Suffix Automaton: a Lyndon substring s[i...i + len - 1] is distinct if its length exceeds the LCP with its predecessor in the Suffix Array (len > LCP[SA_inv[i]]). Counting the valid pairs across the tree resolves the exact number of distinct Lyndon substrings in strict O(n) time and O(1) auxiliary space beyond the suffix arrays.