Another LeetCode problem down! ✅ Today I tackled Valid Anagram. The core of the problem is verifying if two strings contain identical character counts. For my solution, I leveraged Python's built-in sorted() function. The Logic: 1️⃣ Check if the lengths are equal (if not, they can't be anagrams!). 2️⃣ Sort both strings alphabetically. 3️⃣ Compare the sorted strings—if they match perfectly, return True. It’s a clean and readable approach that gets the job done. #Coding #DataStructures #Python3 #LeetCode #SoftwareEngineering
Valid Anagram Solution in Python
More Relevant Posts
-
Just solved “Second Largest Digit in a String” on LeetCode — and here’s the simple approach I followed 👇 Instead of overcomplicating it, I focused on clean thinking + Python basics: 🔹 Converted the string into a set → removes duplicates instantly 🔹 Filtered only digits using isdigit() 🔹 Stored them as integers in a list 🔹 Sorted the list → easy access to largest & second largest 🔹 Edge case check: if less than 2 digits → return -1 💡 Key takeaway: Sometimes the most optimal solution isn’t about complex algorithms — it’s about using the right built-in tools smartly. 🚀 What I’m improving with each problem: • Writing cleaner logic • Thinking in steps instead of rushing • Handling edge cases early Consistency > Complexity. #LeetCode #DSA #Python #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Just solved the “Valid Number” problem on LeetCode! This problem looks simple at first glance—but handling edge cases like decimals, signs, and exponents makes it a great test of attention to detail and logical thinking. ✅ Key takeaways: Careful handling of edge cases is crucial Validating input step-by-step can simplify complex parsing problems Writing clean, readable logic beats overcomplicated solutions 💡 Performance: ⚡ Runtime: 3 ms 🧠 Efficient space usage ✅ All test cases passed Problems like this remind me that consistency in practice is what builds strong problem-solving skills. On to the next one! 🔥 #LeetCode #Coding #Python #ProblemSolving #SoftwareEngineering #AIEngineerJourney link of #Solution :- https://lnkd.in/ga9b5pVb
To view or add a comment, sign in
-
-
I built an agent that knows when it's wrong and fixes itself. Here's how it works: 1. User sends a query. 2. Agent searches Wikipedia. 3. A second LLM call checks: "Does this result actually answer the query? YES or NO." 4. If NO — the agent rewrites the search query and tries again. 5. Max 3 retries. Then it gracefully exits and notifies the user. This is called a self-correction loop. It's the difference between an agent that sometimes works and one you can actually ship. Most tutorials show you step 1 and 2. Nobody shows you steps 3-5. The full code is on my GitHub :- https://lnkd.in/g6NheyW8 What would you add to make this more robust? #LangChain #AIAgents #buildinpublic #Python
To view or add a comment, sign in
-
I wrote about building a RAG pipeline in Go from scratch. Not the architecture. Not the tech stack. The part that actually taught me something staring at scores that looked like this: 0.0164, 0.0161, 0.0158 for every query, across every chunk, and figuring out why. The article covers: - Why I built this in Go instead of Python - Why vector search alone wasn't enough and how RRF solves the score normalization problem - The reranking bug and what flat scores actually tell you - Two bugs I introduced myself that were invisible until I read the raw JSON - What I still haven't built (the eval directory is empty) Link in comments. #golang #rag #buildinpublic
To view or add a comment, sign in
-
When you start working with APIs in Python 🧪 one of the most common ways to see results is with Flask. Just like in a laboratory, you experiment with flasks and ampoules. Here, the Flask is your container. You pour in routes, logic, requests. You observe what comes out. Simple. Lightweight. Immediate feedback. No heavy setup. No complex structure at the beginning. Just you… testing ideas in real time. And that’s exactly why it works so well early on. Because before scaling, before architecture, before optimization… you need a place to experiment. Flask is that place. #Python #Flask #APIs #SoftwareEngineering #BackendDevelopment #DeveloperLife #ContinuousLearning #RotterdamTech
To view or add a comment, sign in
-
💡 #PythonJourney | Day 157 — When Documentation Isn't Enough Someone commented on yesterday's post: "the gap between documented and actually usable is massive". They were right. Swagger looks beautiful, but it doesn't help someone arriving from zero. So I added a "Quick Start" with copy-paste examples that work in 5 minutes. cURL, Python, common errors, everything ready. The insight: first win (getting it to work fast) matters more than perfect documentation. I'm learning that honest feedback > my own assumptions. #API #Documentation #Feedback #Backend #SoftwareDevelopment #Learning
To view or add a comment, sign in
-
-
📝 Why I deliberately write "boring" code: Fancy code is impressive. Boring code is reliable. What boring code looks like: ✅ Clear variable names (customer_count not cc) ✅ Small functions that do one thing ✅ Comments that explain WHY, not WHAT ✅ Consistent formatting ✅ Error handling for edge cases Who benefits? → Future me (6 months from now, I won't remember) → My teammates (they can actually read it) → Production (less surprises at 2 AM) Clever code makes you feel smart. Boring code makes you effective. Which do you prefer to maintain? #CodeQuality #Python #DataEngineering #CleanCode
To view or add a comment, sign in
-
🚀 Day 36 – LeetCode Journey Today’s problem: String to Integer (atoi) ✔️ Handled leading spaces and signs (+/-) ✔️ Processed numeric characters step by step ✔️ Managed overflow conditions within 32-bit integer range 💡 Key Insight: Carefully handling edge cases (like spaces, signs, and overflow) is just as important as the core logic. Small conditions can make a big difference in correctness. This problem strengthened my understanding of string parsing, edge cases, and boundary conditions. Learning to write robust and reliable code every day 💪🔥 #LeetCode #Day36 #Strings #EdgeCases #Python #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
From “it works” to “it won’t break” While writing a code, Getting it to work is one thing, 𝗠𝗮𝗸𝗶𝗻𝗴 𝘀𝘂𝗿𝗲 𝗶𝘁 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗯𝗿𝗲𝗮𝗸 is another. price = products["Laptop"] This works fine… until the 𝗸𝗲𝘆 𝗱𝗼𝗲𝘀𝗻’𝘁 𝗲𝘅𝗶𝘀𝘁 . That’s when the program crashes. So instead of assuming every piece of data is present, Its better to start thinking about what happens when it isn’t. In college projects, we often focus on making things work. In real-world scenarios, 𝗲𝗱𝗴𝗲 𝗰𝗮𝘀𝗲𝘀 matter just as much. 𝗗𝗮𝘆 𝟭𝟮/𝟯𝟬 #Python #LearningInPublic #Day12 #30DaysOfCode #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Day 12/100: Mastering Python Loops & range() Today’s coding session was all about automating repetition! I dove deep into for loops and the range() function to control iterations efficiently. Key Takeaways: 🔹 Used range(start, stop, step) to generate precise number sequences. 🔹 Leveraged for loops to iterate through lists and strings. 🔹 Practiced break and continue to manage loop flow. Loops are absolute game-changers for automating repetitive tasks and data processing. 💡 #100DaysOfCode #Python #LearningToCode #DataScience #Automation #ProgrammingBasicsCodegnan
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