Cluster Symbols Linked by Strong Return Correlation
Last updated: November 29, 2026
Quick Overview
Given a list of ticker symbols and pairwise return correlations, group symbols into clusters where two symbols are in the same cluster if they are connected by a chain of pairs whose absolute correlation is at or above a threshold.
SIG
November 29, 20260
0
0 solved
Given a list of ticker symbols and pairwise return correlations, group symbols into clusters where two symbols are in the same cluster if they are connected by a chain of pairs whose absolute correlation is at or above a threshold.
SIG hedges and nets risk across related products such as an ETF and its largest components, and grouping instruments by correlation is a realistic step in that work. The interviewer is testing union-find with path compression and union by size, plus thinking about what threshold-linkage clustering means.
What the Interviewer Expects
- Recognize transitive grouping as connected components
- Implement union-find with path compression and union by size
- Include symbols that have no qualifying pairs as singletons
- Use absolute correlation so strong negative links also cluster
- Return groups in a deterministic order
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Why might single-linkage chaining produce a misleading giant cluster?
- How would you answer queries for many thresholds efficiently?
- How would you maintain clusters as new correlation estimates arrive daily?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: symbols, pairs as (a, b, rho), and threshold. Two symbols join a cluster if abs(rho) >= threshold, and joining is transitive. Output: list of clusters, each sorted, ordered largest fi...
High-Level Design
This is connected components in the graph of strong edges. BFS over an adjacency list works, but union-find is simpler when edges arrive as a list, and it supports adding edges incrementally. Path com...