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 order-theoretic and posets query problem: "Given a partially ordered set (poset) of n elements defined by a Directed Acyclic Graph (DAG) of dependencies, find the maximum size of an antichain (a subset of pairwise incomparable elements) and construct a partition of the poset into the minimum number of chains in polynomial time." I noted that generating all antichains naively requires checking 2^n subsets, which is computationally intractable. I reframed the task through Dilworth's Theorem: the size of a maximum antichain equals the minimum number of chains needed to cover all elements in the poset. The interviewer followed up: "Walk me through how minimum chain cover on a poset reduces to bipartite matching, and explain how Konig's theorem directly extracts the maximum antichain elements from the vertex cover." I explained that we construct a split bipartite graph G' with vertices L = {u_1, ..., u_n} and R = {v_1, ..., v_n}. For every pair where u < v in the poset (computed via transitive closure or reachability), we add a directed edge from u_i to v_j. A matching of size M in G' pairs elements into M disjoint paths, leaving exactly n - M disjoint chains covering the poset. Thus, finding the minimum path cover is equivalent to finding a Maximum Bipartite Matching on G' via Hopcroft-Karp in O(V^(1/2) * E) = O(n^(1/2) * n^2) time. To extract the maximum antichain of size n - M, we find the Minimum Vertex Cover in G' using the standard alternating BFS from unmatched left vertices: let S_L be the unvisited left vertices and S_R be the visited right vertices. An element x belongs to the maximum antichain if and only if x_i is NOT in the vertex cover on the left (x_i not in S_L) and x_j is NOT in the vertex cover on the right (x_j not in S_R). He verified that the resulting subset contains no comparable pairs and matches size n - M, confirming the O(n^2.5) overall runtime. He then shifted to a computational geometry and topology challenge on moving continuous curves: "Given two polygonal curves P and Q in the 2D plane with n and m vertices respectively, determine whether the continuous Frechet Distance between them satisfies delta_F(P, Q) <= epsilon in polynomial time, without approximating it via discrete point sampling." I pointed out that the discrete Frechet distance only checks vertex-to-vertex pairings, missing bottlenecks where a continuous curve deviates between discrete vertices. I proposed constructing the Continuous Free Space Diagram (FSD) in the parameter space [0, n] x [0, m] and searching for a monotone reachability path via Alt and Godau's Algorithm. The interviewer cut in: "Describe the free space cell C(i, j), explain why its interior free space is convex, and show how dynamic programming propagates reachability intervals along cell boundaries." I explained that parameterizing curve P by s in [0, n] and curve Q by t in [0, m] divides the parameter space into n * m rectangular cells C(i, j) = [i, i + 1] x [j, j + 1]. The free space inside cell C(i, j) corresponds to pairs (s, t) such that the Euclidean distance between points P(s) and Q(t) is at most epsilon. Because the distance between points moving linearly along two line segments is a convex quadratic function of s and t, the free space inside any cell C(i, j) is the intersection of an ellipse with the unit square—which is strictly convex. A leash of length epsilon is feasible if and only if there exists a path from (0, 0) to (n, m) that is monotone in both coordinates and remains entirely within the free space. Because each cell boundary interval (horizontal bottom L_{i,j} and vertical left B_{i,j}) is a contiguous 1D segment, we compute reachable intervals dynamically: the reachable portion on the right boundary R_{i,j} is determined by whether the lower or left intervals can reach through the convex ellipse in O(1) time. Propagating these reachability intervals across all n * m cells runs in strict O(n * m) time, enabling an exact decision procedure that binary searches for the optimal epsilon in O(n * m * log(1 / precision)) time and O(n * m) space. For the final challenge, he introduced an algebraic counting problem on tree topologies: "Given an arbitrary unlabeled tree T with n vertices, compute the size of its Automorphism Group |Aut(T)| (the number of graph isomorphisms from T to itself) in strict O(n) or O(n log n) deterministic time." I noted that graph automorphism is generally in NP-intermediate and takes quasi-polynomial time for general graphs, but the acyclic structure of trees allows a rooted inductive canonical factorization. I proposed using Canonical Tree Isomorphism via the AHU Algorithm (Aho, Hopcroft, Ullman) paired with Centroid Rooting and Orbit Counting. The interviewer challenged me: "Walk me through how rooting at the centroid handles symmetric trees with two centroids, and how the factorial products of identical subtree equivalence classes compute the exact automorphism count." I explained that we first compute the centroid(s) of T. If T has a unique centroid C, we root T at C. If T has two centroids C_1 and C_2, we insert a virtual node along edge (C_1, C_2) and root at this node. Rooting at the centroid guarantees that any automorphism of T must fix the root or swap the two centroids (accounted for by a factor of 2). Next, we compute canonical representations for all subtrees using AHU bottom-up: each leaf receives canonical string "()", and an internal node v with child canonical strings s_1, s_2, ..., s_k constructs its canonical string by sorting the children lexicographically and concatenating them as "(" + s_{sorted} + ")". Crucially, during this bottom-up pass, let the children of v partition into equivalence classes of canonically identical subtrees with multiplicities m_1, m_2, ..., m_r. Any automorphism fixing v can independently permute identical isomorphic child subtrees in any of m_i! ways, while recursively preserving their internal automorphisms. Therefore, the local automorphism count at node v is given by Aut(v) = (prod_{i=1}^r m_i!) * (prod_{u in children(v)} Aut(u)). Using integer hash labels instead of string concatenations, sorting child signatures takes O(deg(v) * log(deg(v))), evaluating the exact automorphism count in O(n log n) time and O(n) space without arbitrary-precision string blowup.