Daily iOS
CS fundamentals and algorithmsMicrosoft

Connected components, recursion limits

An image mask comes as an N×M grid where 1 is foreground and 0 is background. How would you write a function that returns an array with the size of each blob of 1s connected up, down, left, and right? Assume you're processing a 4000×3000 mask on an iPhone.

Submit