About this question
Medium · low_latency · Quant Developer interview question · data structures, union-find, graph, algorithms
Identifying connected accounts is critical for netting positions and calculating aggregated risk exposure in algorithmic trading. By treating accounts within the same legal entity or risk group as a single unit, systems can optimize capital usage and ensure regulatory compliance. Efficiently managing these dynamic groups requires the Disjoint Set Union (DSU) data structure to handle real-time updates and queries with nearly constant time complexity. Task Implement the RiskNetting class and the