Longest Absolute File Path in Leetcode
Well, it is a little bit late to answer this question but I will do it nevertheless, because it's winterbash!
I had a hard time to read your code because of the level of indentation. I would suggest using the default of 4 spaces instead of 1 space.
Another problem with the code had been at first glance the countT variable but just because of the name. Abbreviations makes the code so much harder to read and understand. If the variable would have been named countedTabs its purpose would have been cristal clear.
One should use var if the type is easy to see by the right hand side of the assignment.
Manipulating a loop variable (i) if one can avoid is a bad habit and can lead to hard to find bugs. A simple else if (input[i] == '\t') { ++countedTabs; } would have been the way to avoid this.
If one need to know if a key exists in a Dictionary&lt;TKey, TValue&gt; ContainsKey() is the way to go, but only if the possible value isn't needed. If one needs the value one should use Dictionary&lt;TKey, TValue&gt;.TryGetValue(TKey, out TValue) because accessing the value later by calling Dictionary&lt;TKey, TValue&gt;[TKey] will internal call the ContainsKey() as well.
Instead of doing if (booleanVariable == true) one should use if (booleanVariable). One doesn't need to compare a boolean to true because the result of the comparison is just a boolean value as well. That beeing said, you can safely remove the isFile = false; at the end of that if block because it won't be used anymore. A last word about this if: The comment you placed above the if is a good comment because it describes why you have the if in place.
One last point to make, don't declare multiple variables in one line. This just hurts the readability of the code.
Summing up leads to
public static int LengthLongestPath(string input)
{

    var prefixLength = new Dictionary&lt;int, int&gt;();
    var countedTabs = 0;
    var lengthSoFar = 0;
    var maxLength = 0;
    var isFile = false;

    for (var i = 0; i &lt; input.Length; i++)
    {
        if (input[i] == '\n')
        {
            if (prefixLength.TryGetValue(countedTabs - 1, out int value))
            {
                prefixLength[countedTabs] = lengthSoFar + value + 1;
            }
            else
            {
                prefixLength[countedTabs] = lengthSoFar;
            }

            if (isFile == true)
            {
                maxLength = Math.Max(maxLength, prefixLength[countedTabs]);
                isFile = false;
            }
            lengthSoFar = 0;
            countedTabs = 0;

        }
        else if (input[i] == '\t')
        {
            ++countedTabs;
        }
        else
        {
            ++lengthSoFar;
            if (input[i] == '.')
            {
                isFile = true;
            }
        }
    }
    // To handle cases where file occours in the end of the string.
    if (isFile)
    {
        if (prefixLength.TryGetValue(countedTabs - 1, out int value))
        {
            maxLength = Math.Max(maxLength, value + lengthSoFar + 1);
        }
        else
        {
            maxLength = Math.Max(maxLength, lengthSoFar);
        }
    }
    return maxLength;
}