🧠 #Day11 of #90DaysOfDSA — Problem Solving & String Manipulation 🚀

Today’s DSA grind was all about string manipulation and logical arrays. I tackled four interesting problems that tested my attention to detail and logical reasoning.
🔸 Problem 1: Can Place Flowers
🪻 Concept: Greedy checking of adjacent spots
📌 Key Takeaway: A simple yet elegant greedy check to ensure flowers aren’t placed next to each other.
class Solution:
def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool:
if n == 0:
return True
length = len(flowerbed)
for i in range(length):
if flowerbed[i] == 0:
empty_left = (i == 0 or flowerbed[i - 1] == 0)
empty_right = (i == length - 1 or flowerbed[i + 1] == 0)
if empty_left and empty_right:
flowerbed[i] = 1
n -= 1
if n == 0:
return True
return n == 0
🔸 Problem 2: Kids With the Greatest Number of Candies
🍬 Concept: Comparing each element to the max
📌 Key Takeaway: A simple one-liner with list comprehension helped make this very Pythonic.
class Solution:
def kidsWithCandies(self, candies: List[int], extraCandies: int) -> List[bool]:
maximum = max(candies)
result = []
for i in candies:
if (i + extraCandies) >= maximum:
result.append(True)
else:
result.append(False)
return result
🔸 Problem 3: Reverse Vowels of a String
🔄 Concept: Two-pointer technique
📌 Key Takeaway: Efficient vowel reversal using two pointers for better space optimization.
class Solution:
def reverseVowels(self, s: str) -> str:
vowels = set("aeiouAEIOU")
s = list(s)
left, right = 0, len(s) - 1
while left < right:
if s[left] not in vowels:
left += 1
elif s[right] not in vowels:
right -= 1
else:
s[left], s[right] = s[right], s[left]
left += 1
right -= 1
return "".join(s)
🔸 Problem 4: Reverse Words in a String
📝 Concept: Trim & reverse technique
📌 Key Takeaway: Strip and reverse split words while handling multiple spaces.
class Solution:
def reverseWords(self, s: str) -> str:
words = s.strip().split()
left, right = 0, len(words) - 1
while left < right:
words[left], words[right] = words[right], words[left]
left += 1
right -= 1
return " ".join(words)
💬 Reflection:
Day 11 was about sharpening basic operations in strings and arrays. I'm gaining more confidence with in-place modifications and optimizing my logic.
📌 Stay tuned for Day 12 where I’ll dive deeper into array manipulations and more intermediate problems.
Subscribe to my newsletter
Read articles from Piyush Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Piyush Kumar
Piyush Kumar
Hey there! I’m Piyush Kumar, a curious mind on a mission to master Data Structures & Algorithms — one problem at a time. I’m not just solving questions; I’m building habits, debugging my thinking, and documenting the highs and lows of my coding grind. Whether it’s arrays at midnight, graph theory before coffee, or that satisfying “AC” moment after 17 failed attempts — I’m sharing it all openly. 📚 Currently on a 90-day DSA challenge, I post daily blogs and code logs that unpack: Real-world problem-solving strategies Patterns and techniques I learn (and unlearn) Honest reflections on growth, failure, and consistency Along the way, I’m also exploring how to apply AI to meaningful problems — because I believe in learning out loud and building in public. Let’s connect if you’re into: Open learning journeys 🚀 Problem-solving and pattern recognition 🧠 Building cool things with code ⚙️ ⚡ Follow along and let’s decode DSA — together!