Coupang Interview Experience | Staff | AUG 2026

Don't remember the exact Question, but the question is goes as follows

Graph Problem

There are n warehouses, and two list is provided from and to Edges which are birectional Edge, the goal is to convert the bidirectional into directed graph, so that the number of connected nodes is as less as possible you need to do it optimally.

1 - 2 - 3

you need to connect 1 -> 2 - > 3 here the number of unconnected node is 1 but if you connect 1 -> 2 <- 3 then you get 2, which is wrong.

so the goal is to convert the un-directed graph to a directed edge optimally.

solution explored in interview :

  1. first approch tried connecting the edge direction where the indegree is 0 first lets say we get node from and to as 5,4 then if the indegree of 5 is 0 then make an edge from 4 - > 5

  2. compute number of connected components using DUS, then check if there is cycle then all nodes are connected else, only one node is left and add +1 to the result.

if someone knows the exact leetcode question please tag.

Comments (3)