🚀 Solved: Find a String (Substring Count) Challenge Just solved another problem on HackerRank under the Python Strings section! ✅ 🧠 Problem Overview: Count how many times a substring appears in a string — including overlapping occurrences. 🔍 Key Learnings: Practiced string traversal techniques Understood why built-in methods like count() may not always work (no overlapping support) Strengthened concepts of slicing and iteration in Python 💡 Example Insight: For string "ABCDCDC" and substring "CDC", the answer is 2 (overlapping counts matter!). ⚡ Approach Used: Iterated through the string Compared substrings using slicing Counted valid matches efficiently 📈 Problems like this help build strong fundamentals in string manipulation, which is crucial for coding interviews and real-world applications. #Python #HackerRank #Coding #Strings #ProblemSolving #DSA #LearningJourney #AI link of #Solution :- https://lnkd.in/gtqcy8fX
Solved HackerRank Python String Substring Count Challenge
More Relevant Posts
-
Day 37 / #120DaysOfCode – LeetCode Challenge ✅ Problem Solved: • Search a 2D Matrix 💻 Language: Python 📚 Key Learnings: • Applied Binary Search on a 2D matrix • Learned how to treat matrix as a flattened sorted array • Practiced converting 1D index → 2D index (row, col) • Improved understanding of search space reduction • Strengthened logarithmic time complexity (O(log n)) thinking Better logic → Faster execution 🚀 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #BinarySearch #Algorithms #CodingJourney #Consistency #120DaysOfCode
To view or add a comment, sign in
-
-
Day 39 / #120DaysOfCode – LeetCode Challenge ✅ Problem Solved: • Integer to Roman 💻 Language: Python 📚 Key Learnings: • Learned how to map numerical values to symbolic representations • Used greedy approach for optimal conversion • Understood importance of ordered value-symbol pairing • Practiced handling special subtraction cases (IV, IX, XL, etc.) • Improved skills in writing structured and readable logic Consistency + Logic = Growth 🚀 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #Algorithms #CodingJourney #Greedy #120DaysOfCode
To view or add a comment, sign in
-
-
📌 Problem: Reverse Vowels of a String 💡 Approach: Used the two-pointer technique to reverse only the vowels in the string. Initialize one pointer at the beginning and one at the end. Move both pointers inward until vowels are found, then swap them. Continue this process until both pointers meet. ⚙️ Key Insight: Use a set for fast vowel lookup (O(1)) Two-pointer approach avoids extra space for storing vowels separately ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) (due to string → list conversion) 📚 What I learned: Efficient string manipulation using two pointers Optimizing lookups with hash sets #LeetCode #DSA #Algorithms #Coding #ProblemSolving #Python #TwoPointers #InterviewPreparation #CodingJourney
To view or add a comment, sign in
-
Day 28 / #120DaysOfCode – LeetCode Challenge 🚀 Consistency is building momentum 💯 Today’s focus was on String Processing and Frequency Counting, using Python’s built-in tools for efficient solutions. ✅ Problem Solved: • Most Common Word 💻 Language: Python 📚 Key Learnings: • Used regex (re.findall) to extract words cleanly • Applied Counter to count word frequency efficiently • Learned how to handle case-insensitive strings • Filtered out unwanted words using conditions Clean code + built-in functions = powerful solutions 🚀 Every day improving step by step 💪 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #Strings #Regex #ProblemSolving #CodingJourney #Consistency #120DaysOfCode
To view or add a comment, sign in
-
-
Day 60/100 — #100DaysOfCodingChallenge 60 days in… consistency is slowly turning into a habit now. 🔹 Python (DSA) Solved Search a 2D Matrix — used binary search by treating the matrix like a flattened sorted array. It was a nice reminder of how powerful binary search can be when applied smartly. 🔹 SQL Did some light practice to keep concepts fresh and maintain the streak. #Python #SQL #DSA #LeetCode #Day60 #100DaysOfCode #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Python Clarity Series – Episode 25 Topic: Mutable vs Immutable Function Behavior 📌 Why did my list change after function call? def modify(lst): lst.append(100) a = [1, 2] modify(a) print(a) Output: [1, 2, 100] 👉 Lists are mutable → changes reflect outside Now: def modify(x): x = x + 10 a = 5 modify(a) print(a) Output: 5 👉 Integers are immutable → no change outside 💡 Rule: Mutable → changes persist Immutable → changes don’t This confusion causes logic errors. #PythonBasics #FunctionConcepts #StudentClarity #python #clarity
To view or add a comment, sign in
-
-
Day 45 / #120DaysOfCode – LeetCode Challenge ✅ Problem Solved: • Maximum Distance Between Two Different Colors 💻 Language: Python 📚 Key Learnings: • Applied greedy observation-based approach • Learned to compare elements with first and last values • Avoided unnecessary nested loops → kept solution O(n) • Improved thinking in terms of distance maximization • Reinforced writing simple and efficient code Not every problem needs complexity — smart thinking matters 💯 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #Greedy #Algorithms #CodingJourney #120DaysOfCode
To view or add a comment, sign in
-
-
Python Series — Day 3 🧠 Let’s level it up a bit 👇 What will be the output of this code? def modify_list(lst): lst.append(4) a = [1, 2, 3] modify_list(a) print(a) Options: A. [1, 2, 3] B. [1, 2, 3, 4] C. Error D. None Think carefully 👀 (Hint: It’s not about functions… it’s about how Python handles data) Drop your answer 👇 Answer tomorrow 🚀 #Python #CodingChallenge #LearningInPublic #DataEngineering #Tech
To view or add a comment, sign in
-
-
In 𝗙𝗮𝘀𝘁𝗔𝗣𝗜, 𝗿𝗲𝘁𝘂𝗿𝗻 𝘁𝘆𝗽𝗲 and 𝗿𝗲𝘀𝗽𝗼𝗻𝘀𝗲_𝗺𝗼𝗱𝗲𝗹 describe the success body: a single Pydantic model, or a list of that model—whatever the handler returns on a normal 2xx. When a lookup fails or a rule is broken, you raise 𝗛𝗧𝗧𝗣𝗘𝘅𝗰𝗲𝗽𝘁𝗶𝗼𝗻 so the client gets a proper 𝟰𝘅𝘅 𝘀𝘁𝗮𝘁𝘂𝘀 and a 𝗱𝗲𝘁𝗮𝗶𝗹 𝗽𝗮𝘆𝗹𝗼𝗮𝗱. That is separate from the return type, because raise is not return. 𝗿𝗲𝘀𝗽𝗼𝗻𝘀𝗲_𝗺𝗼𝗱𝗲𝗹 defines how the 𝘀𝘂𝗰𝗰𝗲𝘀𝘀 𝗿𝗲𝘀𝗽𝗼𝗻𝘀𝗲 is built and documented; HTTPException is how you answer with an error without faking a 200. 👉 Detailed breakdown here: https://lnkd.in/gcySJqZX 👉 Code Here: https://lnkd.in/gyf4663s #FastAPI #Python #API #BackendDevelopment #SoftwareEngineering #Pydantic #OpenAPI
To view or add a comment, sign in
-
Today I worked on an interesting string problem — counting how many times a substring appears in a string without using built-in methods like count(). At first, it seemed straightforward… until I realized an important twist 👇 👉 Built-in count() does not handle overlapping substrings So I implemented a manual sliding window approach: 🔹 Traverse the string from left to right 🔹 Extract substrings using slicing 🔹 Compare each slice with the target substring 🔹 Increment count when a match is found 💡 Example: String → ABCDCDC Substring → CDC There are 2 occurrences, not 1 — because overlapping is allowed. This small problem helped me understand: How string slicing works internally Why built-in functions aren’t always sufficient The importance of handling edge cases like overlapping 🧠 Key takeaway: Sometimes writing logic manually gives deeper insight than relying on shortcuts. Learning step by step and enjoying the process 🔥 #Python #CodingJourney #100DaysOfCode #ProblemSolving #DataStructures #Learning
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