Find out how long the longest sequence is in a string
<p>I recently had this question in an interview and this is what I came up with.  Any feedback?</p>

<p>Find out how long the longest sequence is in a string.  For example, in the string "abccdeeeeef"  the answer would be 5.</p>

<pre><code>    static int LongestSeq(string strPass)
    {
        int longestSeq = 0;

        char[] strChars = strPass.ToCharArray();

        int numCurrSeq = 1;
        for (int i = 0; i &lt; strChars.Length - 1; i++)
        {
            if (strChars[i] == strChars[i + 1])
            {
                numCurrSeq++;
            }
            else
            {
                numCurrSeq = 1;
            }

            if (longestSeq &lt; numCurrSeq)
            {
                longestSeq = numCurrSeq;
            }
        }

        return longestSeq;
    }
</code></pre>
