Day 27/100 – DSA Practice Solved LeetCode 459: Repeated Substring Pattern today. Key Insight: If a string s is formed by repeating a substring, then it will always exist inside: (s + s)[1:-1] Why this works: Doubling the string generates all possible rotations Removing first & last characters avoids trivial matches If s is found in this modified string, it confirms a repeating pattern This elegant trick reduces the problem to a simple one-liner and highlights the power of pattern observation in strings. Approach Used: return s in (s + s)[1:-1] Constant progress > Perfection. On to the next one! #Day27 #100DaysOfCode #DSA #LeetCode #Python #CodingJourney #ProblemSolving
Rahul kumar’s Post
More Relevant Posts
-
Day 105 Backtracking is becoming more structured now. #Day105 🧩 131. Palindrome Partitioning How today went: • Iterated through the string, taking one substring at a time • Used DFS to explore partitions • Checked if each substring is a palindrome before going deeper • Built the result step by step and backtracked when needed What clicked: At each step: → choose a substring → validate (palindrome) → explore further → backtrack This pattern is repeating across problems. Backtracking is slowly becoming more intuitive. #LeetCode #DSA #Python #Backtracking #DFS #Recursion #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Day 110 Same pattern, new constraint. #Day110 🧩 90. Subsets II How today went: • Very similar to the basic Subsets problem • First step: sort the array • While iterating, skip duplicate elements to avoid repeating subsets • Use the same backtracking pattern: append → recurse → pop What I learned: The core pattern stays the same — only the duplicate handling logic changes. This small condition makes a big difference. Backtracking is becoming more predictable now. #LeetCode #DSA #Python #Backtracking #Recursion #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
🚀 Day [21] of #Geekstreak60 Today’s #POTD was Two Equal Sum Subarrays — a neat exercise in prefix sums, binary search, and validation logic. I solved it in Python using multiple approaches: ✅ Direct prefix sum check ✅ Hash set tracking for generalized detection ✅ Binary search on prefix array for efficient lookup Each method reinforces how different strategies can converge on the same solution, sharpening problem‑solving skills and adaptability. #Coding #Python #Geekstreak60 #ProblemSolving #DSA #GeeksforGeeks #Geekstreak2026 Problem Link : https://lnkd.in/gzdaVpnr Solution Link : https://lnkd.in/gvdHSgwR
To view or add a comment, sign in
-
-
Day 119 Same problem family, new constraint — but now it feels easier. #Day119 🧩 40. Combination Sum II How today went: • Very similar to Combination Sum • First step: sort the array • Move to i + 1 (each element used once) • Skip duplicates to avoid repeating combinations Key idea: 👉 No reuse of same element 👉 Handle duplicates carefully What I realized: Once you understand the base pattern, variants like this become much easier. Backtracking is starting to feel natural now. #LeetCode #DSA #Python #Backtracking #Recursion #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Beyond String Concatenation When I started, I used to concatenate strings the old-school way. It was messy, prone to errors, and hard to read The Problem: Using + requires manual type conversion (like str(21)) and gets confusing with all the extra quotes and spaces Solution: F-strings Introduced in Python 3.6, F-strings makes your code: ✅ Readable: You see the full sentence structure ✅ Fast: They are more efficient than older methods ✅ Flexible: You can perform math or call methods directly inside { } It’s a small concept, but it’s one of the easiest ways to make code look 10x more professional. #Python #30DaysOfCode #BCA #LearningInPublic #Day21 #JECRC Day 21/30
To view or add a comment, sign in
-
-
Day 117 Same pattern, one important tweak. #Day117 🧩 90. Subsets II How today went: • Same base as Subsets • First step: sort the array • While iterating, skip duplicates to avoid repeating subsets • Use the same pattern: append → recurse → pop What I learned: It’s not a new problem — it’s the same pattern with a duplicate filter. Small condition. Big impact. Backtracking is starting to feel predictable. #LeetCode #DSA #Python #Backtracking #Recursion #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
LeetCode Progress Update — 18/100 Just solved “415. Add Strings” This problem was a great reminder that sometimes the best solutions come from going back to fundamentals — in this case, simulating manual addition digit by digit instead of relying on built-in conversions. Key Takeaways: Handling numbers as strings strengthens problem-solving skills Mastering carry logic is essential for many algorithmic problems Clean, efficient logic > shortcuts Problem Level: Easy Concepts: String Manipulation, Simulation Every step forward counts. On to the next one! #100DaysOfCode #DSA #LeetCode #ProblemSolving #CodingJourney #Python
To view or add a comment, sign in
-
-
Solved 𝗟𝗖 𝟮𝟲𝟰𝟬 · Find the Score of All Prefixes of an Array (Medium) First glance at the problem? Skimmed it, saw "prefix" and some operation on elements — 𝗮𝘀𝘀𝘂𝗺𝗲𝗱 𝗶𝘁 𝘄𝗮𝘀 𝘀𝗼𝗺𝗲𝘁𝗵𝗶𝗻𝗴 𝗹𝗶𝗸𝗲 𝘀𝗾𝘂𝗮𝗿𝗶𝗻𝗴. Wrote code. Wrong answer. Read the statement properly this time. Turns out conver[i] = arr[i] + max(arr[0..i]) — each element gets added to the 𝗿𝘂𝗻𝗻𝗶𝗻𝗴 𝗺𝗮𝘅 up to that index. The score of a prefix is just the sum of its conversion array. Track 𝗺𝗮𝘅_𝘀𝗼_𝗳𝗮𝗿 as you iterate, add it to the current element, accumulate into score. 𝗢𝗻𝗲 𝗽𝗮𝘀𝘀, 𝗱𝗼𝗻𝗲. Day 39 — #1000DaysOfLearning #DSA #LeetCode #Python #1000DaysOfLearning #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 48 – LeetCode Journey Today’s challenge: Substring with Concatenation of All Words ✔️ Solved using sliding window + hashmap ✔️ Processed string in fixed-length chunks ✔️ Tracked word frequency efficiently 💡 Key Insight: Instead of checking every substring blindly, splitting the string into word-sized pieces and using a hashmap helps validate matches efficiently. Sliding window keeps the solution optimized. This problem was a great exercise in string manipulation, hashing, and window techniques 🧠 Consistency is the real game changer 🚀 #LeetCode #Day48 #SlidingWindow #HashMap #Strings #Python #ProblemSolving #CodingJourney #100DaysOfCode https://lnkd.in/gxf4RBT6
To view or add a comment, sign in
-
DSA Tip: Queue If you process tasks in random order… you’ll run into problems. Use a Queue. It follows FIFO (First In, First Out) the first item added is the first to be removed. From print jobs to request handling, queues keep systems organized and fair. Insight: Order isn’t just important, it determines how systems behave. Quick Challenge: If you enqueue A, B, C… which comes out first? Drop your answer, I’ll review the best ones. FOLLOW FOR MORE DSA TIPS & INSIGHTS #DSA #Queue #Python #CodingTips #LearnToCode
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development