Day 53 :- 𝗣𝗮𝘁𝘁𝗲𝗿𝗻 𝗠𝗮𝘁𝗰𝗵𝗶𝗻𝗴 𝗶𝗻 𝗦𝘁𝗿𝗶𝗻𝗴𝘀: 𝗜𝘀𝗼𝗺𝗼𝗿𝗽𝗵𝗶𝗰 𝗦𝘁𝗿𝗶𝗻𝗴𝘀 🔤🔁 Today’s DSA session was about understanding character mapping and pattern consistency using LeetCode 205: Isomorphic Strings. This problem is a great way to strengthen understanding of hashing + mapping patterns in strings. 🔹 𝗧𝗵𝗲 𝗖𝗵𝗮𝗹𝗹𝗲𝗻𝗴 Given two strings s and t, determine if they are isomorphic. 👉 Two strings are isomorphic if characters in s can be replaced to get t, while maintaining order. 👉 No two characters can map to the same character (one-to-one mapping). 🔹 𝗧𝗵𝗲 𝗞𝗲𝘆 𝗜𝗻𝘀𝗶𝗴𝗵𝘁 💡 This problem combines: • Character mapping • Tracking last seen positions 👉 Instead of explicitly storing mappings, we track last occurrence index of characters. 🔹 𝗖𝗼𝗿𝗲 𝗟𝗼𝗴𝗶𝗰 ✔️ If lengths are different → return false ✔️ Use two arrays to track last seen positions: • lastS for string s • lastT for string t ✔️ For each index i: • If last occurrence of s[i] ≠ last occurrence of t[i] → not isomorphic • Update both with i + 1 👉 Using i + 1 avoids confusion with default value 0 🔹 𝗪𝗵𝘆 𝗧𝗵𝗶𝘀 𝗪𝗼𝗿𝗸𝘀 👉 Ensures consistent mapping pattern 👉 If two characters behaved differently before → mismatch detected 👉 No need for complex hash maps 🔹 𝗘𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝗰𝘆 ⚡ • Time Complexity → O(n) • Space Complexity → O(1) (fixed size arrays) 🔹 𝗞𝗲𝘆 𝗧𝗮𝗸𝗲𝗮𝘄𝗮𝘆 💡 👉 Pattern problems can often be solved using last seen indices 👉 Always think of simpler representations before jumping to hash maps 👉 Consistency in mapping is more important than actual values 🙏 Huge thanks to my mentors Anchal Sharma and Ikshit .. for guiding me in recognizing patterns in string problems. This approach makes many problems much simpler! #DSA #Java #100DaysOfCode #Strings #Hashing #ProblemSolving #Mentorship #LeetCode #SoftwareEngineering #CodingJourney 🚀
Isomorphic Strings Problem Solving with LeetCode 205
More Relevant Posts
-
#Day92 Of Problem Solving Today’s LeetCode problem turned out to be simpler than I expected — but only after looking at it from the right angle. At first, I was thinking of solving it using loops or recursion. But then I realized there’s a much cleaner way using a small mathematical trick to check if a number is a power of three. That shift in thinking made the solution not just easier, but also more efficient. Result: Runtime: 7 ms (beats 100%) Memory: 46 MB Moments like this remind me that problem solving isn’t always about writing more code, it’s about finding better approaches.Trying to stay consistent and improve a little every day. #LeetCode #Java #DSA #ProblemSolving #CodingJourney #LinkedIn
To view or add a comment, sign in
-
-
“What I learned after solving 300+ LeetCode problems 👇” At the beginning, I made a mistake. I kept solving random problems every day thinking: “More problems = more skill” But I was wrong. I realized that solving problems randomly is mostly a waste of time if you don’t understand the pattern behind them. Everything changed when I started focusing on patterns instead of problems. Here are some important patterns I learned: • Sliding Window • Two Pointers • Prefix Sum • Binary Search • Recursion & Backtracking • Linked List Patterns • Stack & Monotonic Stack • Hashing / Frequency Count Once you understand these patterns: You don’t need to solve 1000 problems. You start recognizing solutions instantly. Now when I see a problem, I don’t panic. I ask: 👉 “Which pattern does this belong to?” That one question changed everything for me. Still learning, but now with direction 🚀 #DSA #LeetCode #Java #BackendDevelopment #CodingJourney
To view or add a comment, sign in
-
There was a time when even starting a problem felt confusing. Reading the question multiple times, not knowing where to begin, and getting stuck often. With consistent practice, things started to change — patterns became familiar, approaches became clearer, and solving started to feel more structured. That consistency has now led to solving 150 problems on LeetCode. Focused on building a strong foundation through arrays, strings, hashing, sliding window, and binary search — spending more time understanding the logic rather than just aiming for accepted submissions. This journey improved: * Problem breakdown and thinking approach * Pattern recognition across questions * Code clarity and structure Currently working on improving speed and taking on more challenging problems. 🔗 LeetCode Profile: https://lnkd.in/gkf7m6wp #LeetCode #DSA #Java #ProblemSolving #Coding #SoftwareEngineering
To view or add a comment, sign in
-
-
I'll be discussing Test Driven Development tonight 7pm with Shammy Narayanan. Why TDD? And is TDD even relevant today in the age of AI and Agentic coding? Join the discussion to get the answers 😃 Details in the post below 👇🏽
Stop testing your code. Start designing it. Is TDD a "testing ritual" or a powerful thinking tool? Join us for a high-impact Virtual Tech Book Review Meetup featuring Siddharta Govindaraj author of "Test-Driven Python Development". We’ll be diving deep into how TDD isn't just about catching bugs it’s about clarifying requirements and crafting cleaner, decoupled architectures. 📅 Date: March 28th 🕖 Time: 7:00 PM IST 📍 Location: Virtual (Registration form in comment section) Why this session is a game-changer: Most developers see TDD as a chore. Siddhartha flips the script by showing how it acts as a safety net for rapid change and a guide for better software design. What we’ll cover: The Red-Green-Refactor Loop: A step-by-step breakdown of the TDD heartbeat. Design over Ritual: How to use tests to iteratively structure your code and clarify logic. The Python Ecosystem: A comparison of unittest, pytest, and nose, including advanced features like parallel testing. Practical Automation: Integrating tests into CI/CD pipelines to ensure every change is verified. Living Documentation: How fast, isolated tests become the ultimate manual for your codebase. Who should attend? Whether you’re a practicing engineer or an aspiring dev, you’ll walk away with a disciplined workflow that reduces regressions and gives you the confidence to refactor like a pro. Let’s move beyond "checking for correctness" and start building for excellence. See you there! #TestDrivenDevelopment #PythonDev #SoftwareArchitecture #TechMeetup
To view or add a comment, sign in
-
-
🔥 Day 31/100 – DSA Problem Solving 📌 Problem: 412. Fizz Buzz (LeetCode) Today’s problem looks simple, but it really tests your logic building and attention to detail. 💡 My Approach: I used a loop from 1 to n For each number: If divisible by both 3 & 5 → "FizzBuzz" If divisible by 3 → "Fizz" If divisible by 5 → "Buzz" Otherwise → convert number to string 🧠 What I Learned Today: ✅ Importance of using the correct variable inside loops ✅ Order of conditions matters (3 & 5 first) ✅ Writing clean and readable logic ✅ Even easy problems can teach debugging skills 🚀 Key Takeaway: Don’t underestimate easy problems — they help build strong fundamentals and improve problem-solving thinking. 💻 Code Concept: Used simple loop + conditional statements + list to store results. #Day31 #100DaysOfCode #DSA #LeetCode #Java #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 8 of Java with DSA Journey 🚀 📌 Topic: FizzBuzz (LeetCode 412) 💬 "Clean code is not written by following rules, but by following logic." ✨ What I learned today: 🔹 Condition Priority Matters Checking FizzBuzz (divisible by both 3 & 5) first is crucial. Order defines correctness. 🔹 String Handling Used Integer.toString(i) for clean output formatting. 🔹 Code Readability Even simple problems test how clearly you structure your logic. 🔹 Complexity Awareness ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) (excluding output list) 🧠 Problem Solved: ✔️ FizzBuzz 🎨 Visualizing the Logic (Decision Tree) Each number flows through conditions like a filter. It stops at the first true condition, which makes ordering critical. 💡 Key Insight: FizzBuzz may look simple, but it teaches precise logical structuring and modular arithmetic (%). 👉 The “15 Test”: If we check i % 3 == 0 first, 15 becomes "Fizz" and skips "Buzz". By checking (i % 3 == 0 && i % 5 == 0) first, we correctly get "FizzBuzz". ⚡ Interview Insight (Scalability Twist): What if we add a new condition like 7 → "Bazz"? Instead of messy if-else, use string concatenation: String currentStr = ""; if (i % 3 == 0) currentStr += "Fizz"; if (i % 5 == 0) currentStr += "Buzz"; if (currentStr.isEmpty()) currentStr += i; answer.add(currentStr); ✅ Easier to extend ✅ Cleaner logic ✅ More maintainable 🔑 Takeaway: Consistency beats complexity. Showing up daily builds real problem-solving skills. #DSA #LeetCode #Java #CodingJourney #ProblemSolving #Day8 #CleanCode #SoftwareEngineering #FizzBuzz #Array #InterviewPrep #Optimization #MCA #lnct #100DaysOfCode #SoftwareEngineering #InPlaceAlgorithms #TechLearning #JavaDeveloper
To view or add a comment, sign in
-
-
Most people think coding is about writing logic. But it's something deeper… It’s about thinking clearly when things don’t work. I spent hours debugging a small issue, not because it was hard, but because my thinking was messy. The moment I slowed down, broke the problem and questioned every assumption… The solution appeared in minutes💡 Good developers don’t just code fast. They think better. And that’s what I’m working on every single day. #SoftwareDevelopment #CodingJourney #ProblemSolving #Java #Learning
To view or add a comment, sign in
-
🚀 200 problems on LeetCode — but the real growth isn’t just a number. Somewhere along the journey, my approach changed. I stopped asking: ❌ “How do I solve this problem?” And started asking: ✅ “Why does this approach work?” ✅ “What pattern is behind this?” ✅ “Where else can I apply this?” That shift made all the difference. 📈 What I’ve built so far: ✔ Stronger problem-solving mindset ✔ Better understanding of data structures ✔ Pattern recognition across problems ✔ More structured debugging approach Now, I don’t just solve problems — I understand them. Still learning. Still improving. But now with clarity and direction. #LeetCode #DSA #ProblemSolving #CodingJourney #Java
To view or add a comment, sign in
-
-
𝐁𝐞𝐜𝐨𝐦𝐢𝐧𝐠 𝐚 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐞𝐫 𝐁𝐞𝐟𝐨𝐫𝐞 𝐁𝐞𝐜𝐨𝐦𝐢𝐧𝐠 𝐚𝐧 𝐄𝐦𝐩𝐥𝐨𝐲𝐞𝐞 1.6% of transforming into a developer. Yesterday I explored how classes can be connected using Inheritance. Today, I focused on understanding another important concept — Polymorphism. What I practiced today: • Runtime Polymorphism → Method Overriding (Employee → Developer / Manager) • Method Overloading → Handling multiple inputs in Python • Applying polymorphism in simple real-world scenarios I practiced using .ipynb notebooks, writing code step by step, testing outputs, and refining my understanding. I also pushed my practice code to GitHub, continuing my habit of tracking progress. What changed in my thinking today: Before → Writing separate methods for different behaviors Now → Writing one method that works differently based on the object That helped me understand: Polymorphism is about writing flexible code. The goal remains the same: Learn daily. Improve daily. Level up daily. 1.6% today. Still building. 🚀 #Python #OOPS #Polymorphism #LearningJourney #DeveloperJourney #StudentDeveloper #Programming #BuildInPublic #Consistency #SoftwareEngineering
To view or add a comment, sign in
-
-
🔥 Day 3 of my 50 Days Wild Coding Kickoff! 🔥 💡 Problem 3: Valid Parentheses (Easy) Given a string containing just '(', ')', '{', '}', '[' and ']', determine if the input string is valid. A string is valid if: ✔ Open brackets are closed by the same type ✔ Open brackets are closed in the correct order Example 1: Input: s = "[]" Output: true Example 3: Input: s = "[(])" Output: false 🚀 Approach (Optimized without Stack class): Instead of using Java’s built-in Stack, I used a char array to simulate a stack for better performance. Created a char[] as stack Used top pointer to track elements Push opening brackets On closing bracket → pop and compare If mismatch or stack empty → invalid #100DaysOfCode #50DaysOfCode #CodingChallenge #JavaDeveloper #DataStructures #Stack #Algorithms #DSA #CodingJourney #InterviewPrep #LeetCode #ProblemSolving #DeveloperLife #CodingDaily #CodePractice
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