Length of longest substring without repeating chars in "toolliyo".
Toolliyo Coach
Progressive help: Nudge → Guide → Approach. Full solution stays behind the Solution tab.
Editor is open — no login wall to practice.
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
string s = "toolliyo";
var seen = new Dictionary<char, int>();
int best = 0, start = 0;
for (int j = 0; j < s.Length; j++) {
if (seen.ContainsKey(s[j]) && seen[s[j]] >= start) start = seen[s[j]] + 1;
seen[s[j]] = j;
best = Math.Max(best, j - start + 1);
}
Console.WriteLine(best);
}
}
Prefer Coach (Nudge → Guide → Approach) before revealing. No forced signup.
Sliding window with hash map.
Sign in to save and review your submission history. You can still Run code on the Editor tab as a guest.
Sign in