← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Given a string, count the number of substrings where all characters are unique (no repeating characters).
Source: LeetCode Discuss - JP Morgan SE3 Interview Experience 2024
A substring is a contiguous sequence of characters within the string. You need to count all substrings where each character appears at most once.
Example: For string "abc", the valid substrings are: "a", "b", "c", "ab", "bc", "abc" = 6 substrings
For string "aba", the valid substrings are: "a", "b", "a", "ab", "ba" = 5 substrings (note: "aba" is not valid because 'a' repeats)