Flood fill (1-d dp)

8
4 5 2 2 1 3 5 5

in this input ,i got output is 3…
first we choose index-5, and colour it Color-5, then we choose index 3,and then we choose index-1,and the choose index-6…but in this question first turn is not count so my output is 3

Hey @Einsteve7974
What exactly is your query here ?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.