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 algebraic graph theory and lattice topology challenge on dynamic planar networks: "Given an undirected planar graph G with n vertices undergoing an online sequence of edge weight updates and edge deletions, maintain the exact All-Pairs Shortest Path (APSP) matrix distances or answer Point-to-Point Shortest Path queries in O(n^{1/2 + epsilon}) time per query, while bounding the amortized update time to sub-linear time." I noted that running Dijkstra takes O(n log n) per query, whereas maintaining the full dynamic APSP matrix naively takes O(n^2) per update (Demetrescu-Italiano). For planar topologies, I proposed using Klein's Multiple-Source Shortest Path (MSSP) trees integrated into an r-Division with Dense Distance Graphs (Fakcharoenphol-Rao / FR-Dijkstra). The interviewer followed up: "Walk me through how an r-division partitions G into O(n / r) regions with O(sqrt(r)) boundary vertices each, and explain how Monge matrix properties over boundary nodes allow FR-Dijkstra to relax edge steps in sub-linear time without checking all boundary pairs." I explained that an r-division constructs O(n / r) edge-disjoint subgraphs (pieces), each containing at most r vertices and at most O(sqrt(r)) boundary vertices (nodes shared with other pieces). Within each piece, we consider the boundary-to-boundary distance matrix M. Crucially, because the boundary vertices lie cyclically on a constant number of facial holes, the distance matrix M satisfies the Monge property (or non-crossing shortest path condition): M[i, k] + M[j, l] >= M[i, l] + M[j, k] for cyclic indices i < j and k < l. This Monge property ensures that row-minima searches can be evaluated in parallel without testing all O(r) combinations. Fakcharoenphol and Rao designed a specialized priority-queue relaxation scheme (FR-Dijkstra) that simulates Dijkstra exclusively on these boundary-to-boundary Dense Distance Graphs: instead of inserting O(r) edges per piece, FR-Dijkstra uses the SMAWK or recursive matrix searching algorithm to extract the next closest boundary vertex in O(log^2 r) amortized steps. Setting r = n / log^c n balances the recursive level depths, allowing edge updates within a piece to rebuild internal MSSP trees in O(r log r) time, while cross-piece shortest path queries run in strict O(sqrt(n) log^2 n) time and O(n) total space. He then shifted to a computational geometry and discrete configuration challenge: "Given a set S of n points in general position in the 2D plane, determine whether S contains the vertices of a strictly Convex k-gon in polynomial time parameterized by k (the Erdős-Szekeres / Happy Ending Problem), and find the largest subset of points in convex position in optimal O(n^3) deterministic time and O(n^2) space." I observed that checking all (n choose k) subsets naively takes exponential time O(n^k). I proposed utilizing Dynamic Programming over Dual Angular Orientations (the Chvátal-Klincsek Algorithm) combined with the Topological Sweep of the Dual Line Arrangement. The interviewer cut in: "Walk me through how sorting edges by direction converts convex polygon detection into finding a longest directed path in an acyclic tournament, and explain why the sign of the cross-product ensures convexity without verifying non-local point enclosures." I explained that any convex polygon has a unique lowest vertex (the anchor); by sorting all points by y-coordinate, the boundary of any convex polygon decomposes into a lower chain and an upper chain of edges that turn consistently left (positive signed area). Consider directed segments e = (p_i, p_j) with y(p_i) < y(p_j). A pair of consecutive directed segments (p_h, p_i) and (p_i, p_j) forms a valid convex turn if and only if the orientation predicate det([[x_h, y_h, 1], [x_i, y_i, 1], [x_j, y_j, 1]]) > 0 (a counter-clockwise turn). We define DP[i][j] as the length of the longest convex chain ending with the directed edge (p_i, p_j). To compute DP[i][j] in O(1) amortized time, we sort all incoming edges to p_i and all outgoing edges from p_i radially by angle. Because the orientation test with preceding points p_h is monotonic with respect to the polar angle around p_i, we maintain the maximum value of DP[h][i] using a two-pointer sweep as the outgoing edge (p_i, p_j) rotates. Summing this angular sweep over all n vertices processes all O(n^2) edges in strict O(n^2 log n) time (or O(n^2) via dual line arrangement sweeping). The longest convex chain of length k - 1 closed by the segment (p_j, p_anchor) identifies the maximum convex k-gon in strict O(n^3) time and O(n^2) memory. For the final challenge, he introduced an algebraic string structure and multidimensional sequence indexing problem: "Given an arbitrary string s of length n, build an index that supports Jumbled / Permutation Substring Matching—given an online query Parikh vector v = (c_1, c_2, ..., c_{|Sigma|}) specifying the exact frequency count of each alphabet character, determine in O(1) or sub-linear time whether there exists ANY substring in s whose character counts match v identically—using O(n^2 / log n) preprocessing time and space." I pointed out that scanning with a sliding window takes O(n) per query, which is too slow when millions of Parikh queries arrive. Conversely, storing all O(n^2) distinct substring Parikh vectors in a hash table takes quadratic space and runs out of memory for large texts. I proposed constructing the Parikh Matrix / Interval Wavefront Transform using Cicalese-Fici-Kociumaka's Compressed Binary Jumbled Indexing with 2D Pareto Frontiers. The interviewer challenged me: "For a binary alphabet Sigma = {a, b}, the count of 1s in a window of length L satisfies the intermediate value property; walk me through how computing the minimum and maximum 1-count arrays min_1[L] and max_1[L] compresses all jumbled matches into 1D interval lookups in O(1) query time." I broke down the algebraic reduction: let the alphabet be binary Sigma = {0, 1}. Any substring of length L has an exact count of 1s, denoted ones(w) in {0, ..., L}. Crucially, as a window of fixed length L slides across text s from left to right, the count of 1s changes by at most 1 at each step: Delta in {-1, 0, +1}. By the Discrete Intermediate Value Theorem, for any fixed length L, the set of 1-counts achievable by substrings of length L forms a contiguous, gapless integer interval [min_1[L], max_1[L]]. Therefore, a query Parikh vector v = (cnt_0, cnt_1) with L = cnt_0 + cnt_1 matches a substring in s if and only if min_1[L] <= cnt_1 <= max_1[L]. To evaluate min_1[L] and max_1[L] for all 1 <= L <= n in sub-quadratic time without testing all n - L + 1 windows: we compute the 1-bit prefix sums P[i] = rank_1(s, i). The problem of finding min_1[L] = min_{i} (P[i + L] - P[i]) is equivalent to the (min, +) convolution of the prefix sum sequence with itself. Using the Burkhart-Kärkkäinen bit-parallel acceleration or Chan-Lewenstein sub-quadratic (min, +) convolution over bounded-difference sequences, all n intervals [min_1[L], max_1[L]] are precomputed in O(n^2 / log n) time and stored in two flat arrays of size n. When an online query (cnt_0, cnt_1) arrives, we set L = cnt_0 + cnt_1 and test min_1[L] <= cnt_1 <= max_1[L] in strict O(1) worst-case time using O(n) query storage.