← Back to Games

🔍 Substring Explorer

0
1
STRING WORLD
- to -

🎯 Mission

Select a start index (click first) and end index (click second) to extract a substring!

Your extracted substring will appear here
String Length (N)
0
Total Possible Substrings
0
Current Selection Length
0

📐 Bonus: Substring Count Formula

Total Substrings = N × (N + 1) / 2

For a string of length N, there are N×(N+1)/2 possible non-empty substrings

📋 All Substrings

Click "Show All" to display all possible substrings

💡 Algorithm: Substring Generator

function getAllSubstrings(str) { const substrings = []; const n = str.length; // For each starting position for (let i = 0; i < n; i++) { // For each ending position for (let j = i + 1; j <= n; j++) { substrings.push(str.substring(i, j)); } } return substrings; } // Total count formula: N × (N + 1) / 2 function countSubstrings(n) { return (n * (n + 1)) / 2; }