If you just want the largest flood-fillable area, then you can use a standard flood-fill algorithm, counting the number of nodes you fill, while filling them with a value which indicates that they should not be visited again. This will be O(n2) for a n x n array, which should be optimal.
If you want the longest sequence, as opposed to the largest area, then you would have to search for the longest Hamiltonian path within each flood-fill area. Unfortunately, you're out of luck, according to Hamilton Paths in Grid Graphs (1982) by Alon Itai, Christos H. Papadimitriou, and Jayme Luiz Szwarcfiter. I couldn't find a non-paywall version, but the abstract seems clear enough. (Of course, the fact that a problem is NP-complete doesn't mean that its unsolvable. Maybe your N is small enough to make it practical.)