An image editor's magic wand selects a pixel and every pixel connected to it (up, down, left, or right) that has exactly the same color. The image is a grid of color numbers.
Write biggestSelection(image) that returns the largest number of pixels any single magic wand click could select.
Input: image = [[1,1,2],[1,1,2],[3,3,2]] Output: 4
The four 1s in the top-left touch each other. The 2s make 3 and the 3s make 2.
Input: image = [[5]] Output: 1
A single pixel is a selection of 1.
1 <= image.length, image[i].length <= 2000 <= image[i][j] <= 10^6Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #423 Biggest Magic Wand Selection. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.