← BNY Mellon questions
CodingHard

Sum of ceil square root of node counts in graph components

Filed under BNY Mellon

Given `n` nodes labeled from 1 to `n` and an array of undirected edges, find all connected components in the graph. For each component of size `S`, compute `ceil(sqrt(S))`. Return the total sum of…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related BNY Mellon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.