7 views
27 Jan 2026
Generate all possible arrangements of string characters.
Real Life: Password combinations, cryptography.
Step-by-Step Logic:
1. Fix one character
2. Generate permutations of remaining characters...
6 views
27 Jan 2026
Compress string by showing character and its count. "aaabbc" -> "a3b2c1"
Real Life: Data compression basics.
Step-by-Step Logic:
1. Count consecutive same characters
2. Write character and its c...
5 views
27 Jan 2026
Check if str2 is rotation of str1. Example: "abcd" -> "cdab".
Real Life: Circular string matching.
Step-by-Step Logic:
1. Check if lengths are equal
2. Concatenate str1 with itself
3. Check if...
5 views
27 Jan 2026
Remove all duplicate characters, keep only first occurrence.
Real Life: Unique character extraction.
Step-by-Step Logic:
1. Track which characters already seen
2. Add character to result only i...
7 views
27 Jan 2026
Find and print the longest word from a sentence.
Real Life: Text analysis, finding important words.
Step-by-Step Logic:
1. Extract each word
2. Compare length with previous longest
3. Update lo...
4 views
27 Jan 2026
Check if two strings have same characters but different order.
Real Life: "listen" and "silent" are anagrams.
Step-by-Step Logic:
1. Count frequency of each character in both strings
2. If all f...
5 views
27 Jan 2026
Check if one string exists inside another string.
Real Life: Search functionality in text.
Step-by-Step Logic:
1. For each position in main string
2. Check if substring matches from that positio...
6 views
27 Jan 2026
Check if one string exists inside another string.
Real Life: Search functionality in text.
Step-by-Step Logic:
1. For each position in main string
2. Check if substring matches from that positio...
5 views
27 Jan 2026
Count total number of words in a sentence.
Real Life: Word count in document editors.
Step-by-Step Logic:
1. Count spaces + 1 = number of words
2. Or count transitions from space to non-space
3...
5 views
27 Jan 2026
Delete all space characters from string.
Real Life: Cleaning up user input.
Step-by-Step Logic:
1. Create new string
2. Copy only non-space characters
3. Skip space characters
4. Return clean...
6 views
27 Jan 2026
Q6: Check Palindrome String
Problem: Check if string reads same forwards and backwards.
Real Life: Words like "madam", "radar", "level".
Step-by-Step Logic:
1. Compare first and last character...
4 views
27 Jan 2026
Check if two strings are exactly same or not.
Real Life: Like password verification.
Step-by-Step Logic:
1. Compare length first
2. If lengths different, strings not equal
3. Compare each chara...
5 views
27 Jan 2026
Reverse the order of characters in string.
Real Life: Like reading text backwards.
Step-by-Step Logic:
1. Use two pointers: start and end
2. Swap characters at start and end
3. Move start forwa...
9 views
27 Jan 2026
Reverse the order of characters in string.
Real Life: Like reading text backwards.
Step-by-Step Logic:
1. Use two pointers: start and end
2. Swap characters at start and end
3. Move start forwa...
4 views
27 Jan 2026
Count how many vowels (a,e,i,o,u) are in string.
Real Life: Analyzing text composition.
Step-by-Step Logic:
1. Check each character
2. If it matches a, e, i, o, u (any case)
3. Increment vowel ...
7 views
27 Jan 2026
Convert all lowercase letters to uppercase.
Real Life: Like CAPS LOCK on keyboard.
Step-by-Step Logic:
1. Check each character
2. If lowercase (a-z), convert to uppercase
3. Subtract 32 from AS...
5 views
27 Jan 2026
Count total characters in a string without using library function.
Real Life: Like counting letters in your name.
Step-by-Step Logic:
1. Start counter from 0
2. Loop through each character
3. S...