Episode 7 — DSA with JavaScript / 7.5 — Strings
7.5.b — String Algorithms
Reverse a string
Input: "hello"
Output: "olleh"
JavaScript
function reverseString(s) {
return s.split("").reverse().join("");
}
// In-place (array of chars)
function reverseInPlace(arr) {
let l = 0, r = arr.length - 1;
while (l < r) {
[arr[l], arr[r]] = [arr[r], arr[l]];
l++; r--;
}
return arr;
}
C++
#include <algorithm>
#include <string>
using namespace std;
string reverseString(string s) {
reverse(s.begin(), s.end());
return s;
}
// Or manually
string reverseManual(string s) {
int l = 0, r = s.size() - 1;
while (l < r) swap(s[l++], s[r--]);
return s;
}
Time: O(n) | Space: O(1) in-place, O(n) if creating new string
Check palindrome
A palindrome reads the same forwards and backwards.
"racecar" → r a c e c a r → palindrome ✓
"hello" → h e l l o → not palindrome ✗
Two-pointer approach:
L → ← R
r a c e c a r
↓ ↓
r == r ✓ → move inward
a == a ✓
c == c ✓
e (middle) → done, palindrome!
JavaScript
function isPalindrome(s) {
s = s.toLowerCase().replace(/[^a-z0-9]/g, "");
let l = 0, r = s.length - 1;
while (l < r) {
if (s[l] !== s[r]) return false;
l++; r--;
}
return true;
}
console.log(isPalindrome("A man, a plan, a canal: Panama")); // true
console.log(isPalindrome("race a car")); // false
C++
#include <string>
#include <cctype>
using namespace std;
bool isPalindrome(string s) {
string clean;
for (char c : s) {
if (isalnum(c)) clean += tolower(c);
}
int l = 0, r = clean.size() - 1;
while (l < r) {
if (clean[l] != clean[r]) return false;
l++; r--;
}
return true;
}
Time: O(n) | Space: O(n) for cleaned string, or O(1) with two pointers on original
Longest Common Prefix
Find the longest common prefix among an array of strings.
Input: ["flower", "flow", "flight"]
f l o w e r
f l o w
f l i g h t
─────
Common prefix: "fl"
JavaScript
function longestCommonPrefix(strs) {
if (strs.length === 0) return "";
let prefix = strs[0];
for (let i = 1; i < strs.length; i++) {
while (strs[i].indexOf(prefix) !== 0) {
prefix = prefix.slice(0, -1);
if (prefix === "") return "";
}
}
return prefix;
}
console.log(longestCommonPrefix(["flower", "flow", "flight"])); // "fl"
C++
string longestCommonPrefix(vector<string>& strs) {
if (strs.empty()) return "";
string prefix = strs[0];
for (int i = 1; i < strs.size(); i++) {
while (strs[i].find(prefix) != 0) {
prefix = prefix.substr(0, prefix.size() - 1);
if (prefix.empty()) return "";
}
}
return prefix;
}
Alternative: vertical scan
function lcpVertical(strs) {
if (!strs.length) return "";
for (let i = 0; i < strs[0].length; i++) {
const ch = strs[0][i];
for (let j = 1; j < strs.length; j++) {
if (i >= strs[j].length || strs[j][i] !== ch) {
return strs[0].slice(0, i);
}
}
}
return strs[0];
}
Time: O(S) where S = sum of all character lengths | Space: O(1)
Character frequency count
Count the frequency of each character in a string.
Input: "hello world"
Output: {h:1, e:1, l:3, o:2, ' ':1, w:1, r:1, d:1}
JavaScript
function charFrequency(s) {
const freq = {};
for (const ch of s) {
freq[ch] = (freq[ch] || 0) + 1;
}
return freq;
}
C++
#include <unordered_map>
unordered_map<char, int> charFrequency(const string& s) {
unordered_map<char, int> freq;
for (char c : s) freq[c]++;
return freq;
}
Find first non-repeating character
function firstUnique(s) {
const freq = {};
for (const ch of s) freq[ch] = (freq[ch] || 0) + 1;
for (const ch of s) {
if (freq[ch] === 1) return ch;
}
return null;
}
console.log(firstUnique("aabcbd")); // "c"
Anagram check
Two strings are anagrams if they contain the same characters in different order.
"listen" and "silent" → sort both → "eilnst" == "eilnst" ✓
JavaScript
function isAnagram(a, b) {
if (a.length !== b.length) return false;
const sort = s => s.toLowerCase().split("").sort().join("");
return sort(a) === sort(b);
}
// O(n) approach with frequency map
function isAnagramMap(a, b) {
if (a.length !== b.length) return false;
const freq = {};
for (const ch of a) freq[ch] = (freq[ch] || 0) + 1;
for (const ch of b) {
if (!freq[ch]) return false;
freq[ch]--;
}
return true;
}
C++
bool isAnagram(string a, string b) {
if (a.size() != b.size()) return false;
sort(a.begin(), a.end());
sort(b.begin(), b.end());
return a == b;
}
// O(n) with frequency array
bool isAnagramFreq(const string& a, const string& b) {
if (a.size() != b.size()) return false;
int freq[26] = {0};
for (char c : a) freq[c - 'a']++;
for (char c : b) {
if (--freq[c - 'a'] < 0) return false;
}
return true;
}
Group anagrams
function groupAnagrams(strs) {
const map = {};
for (const s of strs) {
const key = s.split("").sort().join("");
(map[key] ??= []).push(s);
}
return Object.values(map);
}
console.log(groupAnagrams(["eat","tea","tan","ate","nat","bat"]));
// [["eat","tea","ate"], ["tan","nat"], ["bat"]]
Longest substring without repeating characters
Input: "abcabcbb"
Sliding window:
a b c a b c b b
─────
abc → length 3 (hit 'a' again, shrink from left)
b c a → length 3
c a b → length 3
Answer: 3
function lengthOfLongestSubstring(s) {
const set = new Set();
let left = 0, maxLen = 0;
for (let right = 0; right < s.length; right++) {
while (set.has(s[right])) {
set.delete(s[left]);
left++;
}
set.add(s[right]);
maxLen = Math.max(maxLen, right - left + 1);
}
return maxLen;
}
int lengthOfLongestSubstring(const string& s) {
unordered_set<char> window;
int left = 0, maxLen = 0;
for (int right = 0; right < s.size(); right++) {
while (window.count(s[right])) {
window.erase(s[left++]);
}
window.insert(s[right]);
maxLen = max(maxLen, right - left + 1);
}
return maxLen;
}
Time: O(n) | Space: O(min(n, alphabet size))
String compression
"aabcccccaaa" → "a2b1c5a3"
function compress(s) {
let result = "";
let i = 0;
while (i < s.length) {
let j = i;
while (j < s.length && s[j] === s[i]) j++;
result += s[i] + (j - i);
i = j;
}
return result.length < s.length ? result : s;
}
string compress(const string& s) {
string result;
int i = 0;
while (i < s.size()) {
int j = i;
while (j < s.size() && s[j] == s[i]) j++;
result += s[i] + to_string(j - i);
i = j;
}
return result.size() < s.size() ? result : s;
}
KMP pattern matching (advanced)
The KMP algorithm finds all occurrences of a pattern in a text in O(n+m) time by preprocessing the pattern to skip unnecessary comparisons.
function buildLPS(pattern) {
const lps = [0];
let len = 0, i = 1;
while (i < pattern.length) {
if (pattern[i] === pattern[len]) {
len++;
lps.push(len);
i++;
} else if (len > 0) {
len = lps[len - 1];
} else {
lps.push(0);
i++;
}
}
return lps;
}
function kmpSearch(text, pattern) {
const lps = buildLPS(pattern);
const results = [];
let i = 0, j = 0;
while (i < text.length) {
if (text[i] === pattern[j]) {
i++; j++;
if (j === pattern.length) {
results.push(i - j);
j = lps[j - 1];
}
} else if (j > 0) {
j = lps[j - 1];
} else {
i++;
}
}
return results;
}
Scenario bank (string algorithms)
7.5b-001 — Reverse words in a sentence (variation 1)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-002 — Check if two strings are rotations (variation 2)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-003 — Find all permutations of a string (variation 3)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-004 — Longest palindromic substring (variation 4)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-005 — Minimum window substring (variation 5)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-006 — String to integer (atoi implementation) (variation 6)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-007 — Implement strstr / indexOf from scratch (variation 7)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-008 — Count and say sequence (variation 8)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-009 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 9)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-010 — Longest repeating character replacement (variation 10)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-011 — Valid parentheses string check (variation 11)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-012 — Zigzag string conversion (variation 12)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-013 — Roman to integer conversion (variation 13)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-014 — Integer to Roman conversion (variation 14)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-015 — Implement wildcard pattern matching (variation 15)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-016 — Find all anagrams in a string (sliding window) (variation 16)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-017 — Multiply two large numbers as strings (variation 17)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-018 — Shortest palindrome (prepend characters) (variation 18)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-019 — Rabin-Karp rolling hash string search (variation 19)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-020 — Edit distance between two strings (variation 20)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-021 — Reverse words in a sentence (variation 21)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-022 — Check if two strings are rotations (variation 22)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-023 — Find all permutations of a string (variation 23)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-024 — Longest palindromic substring (variation 24)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-025 — Minimum window substring (variation 25)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-026 — String to integer (atoi implementation) (variation 26)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-027 — Implement strstr / indexOf from scratch (variation 27)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-028 — Count and say sequence (variation 28)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-029 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 29)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-030 — Longest repeating character replacement (variation 30)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-031 — Valid parentheses string check (variation 31)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-032 — Zigzag string conversion (variation 32)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-033 — Roman to integer conversion (variation 33)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-034 — Integer to Roman conversion (variation 34)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-035 — Implement wildcard pattern matching (variation 35)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-036 — Find all anagrams in a string (sliding window) (variation 36)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-037 — Multiply two large numbers as strings (variation 37)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-038 — Shortest palindrome (prepend characters) (variation 38)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-039 — Rabin-Karp rolling hash string search (variation 39)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-040 — Edit distance between two strings (variation 40)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-041 — Reverse words in a sentence (variation 41)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-042 — Check if two strings are rotations (variation 42)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-043 — Find all permutations of a string (variation 43)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-044 — Longest palindromic substring (variation 44)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-045 — Minimum window substring (variation 45)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-046 — String to integer (atoi implementation) (variation 46)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-047 — Implement strstr / indexOf from scratch (variation 47)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-048 — Count and say sequence (variation 48)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-049 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 49)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-050 — Longest repeating character replacement (variation 50)
- Level: Beginner
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-051 — Valid parentheses string check (variation 51)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-052 — Zigzag string conversion (variation 52)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-053 — Roman to integer conversion (variation 53)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-054 — Integer to Roman conversion (variation 54)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-055 — Implement wildcard pattern matching (variation 55)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-056 — Find all anagrams in a string (sliding window) (variation 56)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-057 — Multiply two large numbers as strings (variation 57)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-058 — Shortest palindrome (prepend characters) (variation 58)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-059 — Rabin-Karp rolling hash string search (variation 59)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-060 — Edit distance between two strings (variation 60)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-061 — Reverse words in a sentence (variation 61)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-062 — Check if two strings are rotations (variation 62)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-063 — Find all permutations of a string (variation 63)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-064 — Longest palindromic substring (variation 64)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-065 — Minimum window substring (variation 65)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-066 — String to integer (atoi implementation) (variation 66)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-067 — Implement strstr / indexOf from scratch (variation 67)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-068 — Count and say sequence (variation 68)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-069 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 69)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-070 — Longest repeating character replacement (variation 70)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-071 — Valid parentheses string check (variation 71)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-072 — Zigzag string conversion (variation 72)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-073 — Roman to integer conversion (variation 73)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-074 — Integer to Roman conversion (variation 74)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-075 — Implement wildcard pattern matching (variation 75)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-076 — Find all anagrams in a string (sliding window) (variation 76)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-077 — Multiply two large numbers as strings (variation 77)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-078 — Shortest palindrome (prepend characters) (variation 78)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-079 — Rabin-Karp rolling hash string search (variation 79)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-080 — Edit distance between two strings (variation 80)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-081 — Reverse words in a sentence (variation 81)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-082 — Check if two strings are rotations (variation 82)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-083 — Find all permutations of a string (variation 83)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-084 — Longest palindromic substring (variation 84)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-085 — Minimum window substring (variation 85)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-086 — String to integer (atoi implementation) (variation 86)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-087 — Implement strstr / indexOf from scratch (variation 87)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-088 — Count and say sequence (variation 88)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-089 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 89)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-090 — Longest repeating character replacement (variation 90)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-091 — Valid parentheses string check (variation 91)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-092 — Zigzag string conversion (variation 92)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-093 — Roman to integer conversion (variation 93)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-094 — Integer to Roman conversion (variation 94)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-095 — Implement wildcard pattern matching (variation 95)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-096 — Find all anagrams in a string (sliding window) (variation 96)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-097 — Multiply two large numbers as strings (variation 97)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-098 — Shortest palindrome (prepend characters) (variation 98)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-099 — Rabin-Karp rolling hash string search (variation 99)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-100 — Edit distance between two strings (variation 100)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-101 — Reverse words in a sentence (variation 101)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-102 — Check if two strings are rotations (variation 102)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-103 — Find all permutations of a string (variation 103)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-104 — Longest palindromic substring (variation 104)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-105 — Minimum window substring (variation 105)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-106 — String to integer (atoi implementation) (variation 106)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-107 — Implement strstr / indexOf from scratch (variation 107)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-108 — Count and say sequence (variation 108)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-109 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 109)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-110 — Longest repeating character replacement (variation 110)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-111 — Valid parentheses string check (variation 111)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-112 — Zigzag string conversion (variation 112)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-113 — Roman to integer conversion (variation 113)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-114 — Integer to Roman conversion (variation 114)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-115 — Implement wildcard pattern matching (variation 115)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-116 — Find all anagrams in a string (sliding window) (variation 116)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-117 — Multiply two large numbers as strings (variation 117)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-118 — Shortest palindrome (prepend characters) (variation 118)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-119 — Rabin-Karp rolling hash string search (variation 119)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-120 — Edit distance between two strings (variation 120)
- Level: Intermediate
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-121 — Reverse words in a sentence (variation 121)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-122 — Check if two strings are rotations (variation 122)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-123 — Find all permutations of a string (variation 123)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-124 — Longest palindromic substring (variation 124)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-125 — Minimum window substring (variation 125)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-126 — String to integer (atoi implementation) (variation 126)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-127 — Implement strstr / indexOf from scratch (variation 127)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-128 — Count and say sequence (variation 128)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-129 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 129)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-130 — Longest repeating character replacement (variation 130)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-131 — Valid parentheses string check (variation 131)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-132 — Zigzag string conversion (variation 132)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-133 — Roman to integer conversion (variation 133)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-134 — Integer to Roman conversion (variation 134)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-135 — Implement wildcard pattern matching (variation 135)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-136 — Find all anagrams in a string (sliding window) (variation 136)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-137 — Multiply two large numbers as strings (variation 137)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-138 — Shortest palindrome (prepend characters) (variation 138)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-139 — Rabin-Karp rolling hash string search (variation 139)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-140 — Edit distance between two strings (variation 140)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-141 — Reverse words in a sentence (variation 141)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-142 — Check if two strings are rotations (variation 142)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-143 — Find all permutations of a string (variation 143)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-144 — Longest palindromic substring (variation 144)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-145 — Minimum window substring (variation 145)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-146 — String to integer (atoi implementation) (variation 146)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-147 — Implement strstr / indexOf from scratch (variation 147)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-148 — Count and say sequence (variation 148)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-149 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 149)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-150 — Longest repeating character replacement (variation 150)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-151 — Valid parentheses string check (variation 151)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-152 — Zigzag string conversion (variation 152)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-153 — Roman to integer conversion (variation 153)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-154 — Integer to Roman conversion (variation 154)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-155 — Implement wildcard pattern matching (variation 155)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-156 — Find all anagrams in a string (sliding window) (variation 156)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-157 — Multiply two large numbers as strings (variation 157)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-158 — Shortest palindrome (prepend characters) (variation 158)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-159 — Rabin-Karp rolling hash string search (variation 159)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-160 — Edit distance between two strings (variation 160)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-161 — Reverse words in a sentence (variation 161)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-162 — Check if two strings are rotations (variation 162)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-163 — Find all permutations of a string (variation 163)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-164 — Longest palindromic substring (variation 164)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-165 — Minimum window substring (variation 165)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-166 — String to integer (atoi implementation) (variation 166)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-167 — Implement strstr / indexOf from scratch (variation 167)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-168 — Count and say sequence (variation 168)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-169 — Decode string (e.g., '3[a2[c]]' → 'accaccacc') (variation 169)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.
7.5b-170 — Longest repeating character replacement (variation 170)
- Level: Advanced
- Approach: Apply appropriate technique for this problem class.
- Time complexity: Analyze based on input size.
- Space complexity: Identify auxiliary space used.
- Edge cases: empty input, single element, boundary values.
- JS & C++: Implement in both languages.