Question bank › Sliding Window
Dsa Sliding Window Medium

Longest Even Substring

Given a string consisting of digits (0-9), find the length of the longest contiguous substring where the sum of digits is even. The substring must consist of at least one digit. Input Format: - A single line containing digits (0-9). Output Format: - An integer representing the length of the longest even-sum substring. Example: Input: 12345 Output: 4

Key concepts

sliding_windowstringcounting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.