LINKEDIN SWE OA (2021) | Hierarchical Data Aggregation and Dependency Resolution Using Graph Traversal | Java Solutions
Linkedin · Question · Posted Jun 2026
Q1. Hierarchical Value Aggregation Problem Statement You are given a hierarchical collection of integers where elements can either be: A single integer Another nested collection Each integer contributes to the final result based on its depth level. Weight rules: Depth 1 → Weight = 1 Depth 2 → Weight = 2 Depth 3 → Weight = 3 and so on. Return the weighted sum of all integers. Example Input [[1,1],2,[1,1]] Output 10 Explanation Four occurrences of 1 at depth 2: ...
The full answer & interview discussion are available to premium members.
Log in Create a free account