Build Confidence super easy Question on LeetCode

Perfect — you've already documented your progress really well on core Linked List problems! Here's a continuation post to cover the remaining problems you solved today. You can title this something like:
Today’s focus was not just solving problems, but refining problem-solving intuition across strings, stacks, and binary search—here’s what I tackled:
Problem: Return the length of the last word in a given string.
My Approach:
Traversed from the end to skip trailing spaces.
Counted until the next space (or beginning) appeared.
✅ No need to split or use STL functions like trim.
Problem: Return indices of words that contain a given character.
My Approach:
Nested loop to search character in each word.
Can be optimized using std::string::find instead of full iteration.
✅ Focus: Efficient scanning within strings.
Problem: Find the most frequent vowel and consonant and return their sum.
My Approach:
Counted letter frequency using a 26-size array.
Checked for vowels by comparing indexes (a, e, i, o, u).
✅ Classic frequency array use case.
Problem: Count how many stones are also jewels.
My Approach:
Iterated stones, used jewels.find() for each char.
Optimized version could use unordered_set for constant lookup.
✅ Practiced brute-force first, then optimized.
Problem: Validate if the bracket string is properly balanced.
My Approach:
Used a stack to store opening brackets.
Matched and popped on valid closing brackets.
✅ Important for practicing stack fundamentals.
Problem: Simulate stack operations using queues only.
My Approach (1-Queue):
Pushed elements and rotated the queue to maintain order.
✅ Smart technique to convert FIFO to LIFO.
Problem: Guess the picked number using limited API.
My Approach:
Classic binary search to minimize queries.
✅ Clean log(n) solution using s + (e - s) / 2 to avoid overflow.
Problem: Return the largest-valued odd substring.
My Approach:
Scanned from right to find first odd digit.
Returned substring up to that index.
✅ Handled char-to-int conversion carefully.
Problem: Return the common prefix string from an array of strings.
My Approach:
Used the first string as a base and shrunk it while comparing.
✅ Saves time instead of character-by-character brute-force.
✅ Writing clean string traversal logic
✅ Mastering stack-based problems
✅ Building real confidence in binary search
✅ Optimizing code by identifying repeated patterns
✅ Better understanding of input constraints for performance
📅 Continuing the Grind
Up next:
Binary Search Deepe Down
0
2
0