Question bank › Two Pointers
Dsa Two Pointers Hard

Longest Subsequence of Distinct Characters

Given a string, find the length of the longest subsequence of distinct characters. The subsequence must maintain the order of appearance of characters in the original string. Input format: - The first line contains a string s (1 ≤ |s| ≤ 10^5), which consists of lowercase and uppercase English letters. Output format: - Output a single integer, the length of the longest subsequence of distinct characters. Example: Input: abcdabcde Output: 5

Key concepts

two_pointersstringshashmap

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 Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.