Count of distinct substrings solved in JS | GfG | POTD | Streak 365 | Sun, 30 Nov 2025
Автор: NewsCraft Studio (by JKS)
Загружено: 2025-11-29
Просмотров: 34
Описание:
POTD Question was https://www.geeksforgeeks.org/problem...
Count of distinct substrings
Difficulty: Medium Accuracy: 40.21% Submissions: 29K+ Points: 4
Given a string s consisting of lowercase English characters, determine the total number of distinct non-empty substrings present in the string. A substring is defined as a contiguous block of characters within the string.
Two substrings are considered distinct if their contents differ, even if they originate from different positions in the string.
Note: The empty substring is not counted.
Examples :
Input: s = "ababa"
Output: 9
Explanation: All distinct substrings of "ababa" are: "a", "b", "ab", "ba", "aba", "bab", "abab", "baba", "ababa".
Input: s = "aaa"
Output: 3
Explanation: The distinct substrings of "aaa" are: "a", "aa", "aaa".
Constraints:
1 ≤ s.size() ≤ 3000
Expected Complexities
Time Complexity: O(n^2)
Auxiliary Space: O(n^2)
#coding #GeeksforGeeks #ProblemOfTheDay #JavaScript
---
introduction:
name: "Jagadeesh Kumar S"
contact: "+91 73972 85837 | [email protected]"
description: "A problem-solving enthusiast passionate about coding challenges."
technical_achievements:
"Solved 100+ daily coding challenges on GeeksforGeeks"
"Ranked in the top 130 on SRM Institute of Science and Technology's GeeksforGeeks leaderboard"
"Maintained a 100+ day streak for Problem of the Day"
github:
contributions: "Solutions available at https://github.com/JKS-sys/Solution-T..."
---
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: