🗓 Day 5 / 100 – #100DaysOfLeetCode 📌 Problem 2006: Count Number of Pairs With Absolute Difference K The task was to count the number of pairs (i, j) in an array such that the absolute difference between the two elements equals k. 🧠 My Approach: Used a hash map (Counter) to store the frequency of each element. For every number, checked how many times num + k (or equivalently num - k) appears. Accumulated the count efficiently without double-counting pairs. ⏱ Time Complexity: O(n) 💾 Space Complexity: O(n) 💡 Key Learning: This problem helped strengthen my grasp of hash maps and frequency-based counting — a powerful pattern that simplifies many pair-count and difference problems. Every problem adds clarity and confidence — one step closer to mastery 🚀 #100DaysOfLeetCode #LeetCodeChallenge #Python #ProblemSolving #HashMap #DataStructures #Algorithms #DSA #CodingJourney #CodingChallenge #CodeEveryday #CompetitiveProgramming #SoftwareEngineering #LearningInPublic #DeveloperJourney #TechStudent #CodingCommunity #CareerGrowth #KeepLearning #Programmer #LogicBuilding #TechCareer
Solved LeetCode problem 2006 with hash map and frequency counting
More Relevant Posts
-
🚀 Day 29/100 – Third Maximum Number (LeetCode #414) Today’s problem focused on finding the third distinct maximum number in a list — a task that tests both logic and precision. It was a great exercise in sorting, distinct values, and edge cases. This problem reminded me that simplicity in approach often leads to clearer, faster solutions. 🔍 Key Learnings: Handling duplicates using Python sets Sorting efficiently to extract specific elements Always account for edge cases in logic-based questions 🔗 Problem link:https://lnkd.in/gGHddwQB 🧠 Language: Python Every challenge strengthens the coding mindset — one function at a time. On to Day 30 💪 #100DaysOfCode #LeetCode #Python #CodingChallenge #ProblemSolving #Algorithms #PythonProgramming #DataStructures #DailyCoding #CodeJourney #TechCommunity #ProgrammerLife #LearnCoding #CodingConsistency
To view or add a comment, sign in
-
-
🗓 Day 4 / 100 – #100DaysOfLeetCode 📌 Problem 728: Self Dividing Numbers The task was to find all numbers in a given range that are self-dividing — i.e., numbers that are divisible by each of their digits and contain no zero. 🧠 My Approach: Iterated through the range of numbers. Checked each digit of a number to ensure: It’s non-zero. The original number is divisible by that digit. Collected all numbers that satisfied both conditions. ⏱ Time Complexity: O(n × d) — where d is the number of digits in each number. 💾 Space Complexity: O(1) 💡 Key Learning: This problem strengthened my understanding of digit-wise iteration and conditional logic — simple concepts that are essential for handling number-based and math-intensive problems efficiently. Small problems like these build the habit of writing clean, readable, and logical code — one step closer each day 🚀 #100DaysOfLeetCode #LeetCodeChallenge #Python #ProblemSolving #LogicBuilding #Programming #DataStructures #Algorithms #DSA #CodingJourney #CodingChallenge #CodeEveryday #LearningInPublic #CompetitiveProgramming #DeveloperJourney #TechStudent #CareerGrowth #CodingCommunity #KeepLearning
To view or add a comment, sign in
-
-
🗓 Day 14 / 100 – #100DaysOfLeetCode 📌 Problem 1437: Check If All 1’s Are at Least K Places Away The goal was to determine whether every pair of consecutive 1s in the array is separated by at least k zeros. 🧠 My Approach: Traversed the array while tracking the index of the previous 1. On encountering a new 1, checked the distance from the last one. If the gap was smaller than k, the condition failed instantly. This single-pass logic keeps the solution efficient and clean. 💡 Key Learning: This problem reinforced the importance of index tracking and using simple arithmetic comparisons to validate structural constraints. It’s a great reminder that not all problems require heavy algorithms — sometimes, clarity and careful traversal are enough for an optimal solution. Small steps forward build strong reasoning over time 🚀 #100DaysOfLeetCode #LeetCodeChallenge #Python #ProblemSolving #LogicBuilding #Arrays #Algorithms #DataStructures #DSA #CompetitiveProgramming #CodingJourney #SoftwareEngineering #LearningInPublic #DeveloperJourney #TechStudent #CareerGrowth #CodeEveryday #CodingCommunity #KeepLearning #Programming #TechCareer
To view or add a comment, sign in
-
-
🗓 Day 3 / 100 – #100DaysOfLeetCode 📌 Problem 1913: Maximum Product Difference Between Two Pairs The goal was to find the maximum product difference between two pairs of numbers in an array — specifically, the difference between the product of the two largest numbers and the product of the two smallest numbers. 🧠 My Approach: Sorted the array to easily identify the smallest and largest elements. Computed the difference between the product of the two largest numbers and the two smallest numbers. Leveraged sorting for clarity and simplicity in implementation. ⏱ Time Complexity: O(n log n) 💾 Space Complexity: O(1) 💡 Key Learning: This problem reinforced the importance of recognizing when sorting simplifies a problem. Instead of using complex loops or comparisons, a single sort operation can lead to a clean and optimal solution. Every day of this challenge is sharpening my ability to think more analytically and code more efficiently ✨ #100DaysOfLeetCode #LeetCodeChallenge #Python #ProblemSolving #DataStructures #Algorithms #DSA #Sorting #CodingJourney #CodeEveryday #LearningInPublic #CompetitiveProgramming #SoftwareEngineering #DeveloperJourney #TechStudent #CareerGrowth #CodingCommunity #KeepLearning
To view or add a comment, sign in
-
-
🚀 Day 8 of my #180DaysOfDataScience journey! Today, I learned about the core principles of Object-Oriented Programming (OOPs) in Python — the foundation of clean, reusable, and scalable code. 💻 Here are the 4 key pillars of OOPs I explored: 1️⃣ Encapsulation – Protecting data by keeping it private and controlled. 2️⃣ Inheritance – Reusing and extending existing code. 3️⃣ Polymorphism – Same function behaving differently for different objects. 4️⃣ Abstraction – Hiding unnecessary details and showing only what’s needed. These principles help in building efficient, modular, and easy-to-maintain programs. Excited to apply these in real-world projects soon! 🔥 #Day8 #Python #OOPsConcepts #DataScienceJourney #LearningEveryday #CodeNewbie #ObjectOrientedProgramming #TechLearning #PythonDeveloper #DataScienceWithPython #CodingCommunity #180DaysOfDataScience
To view or add a comment, sign in
-
-
Hello, connections 👋 Welcome to Day 9 of my #30DaysOfPython journey! 🚀 Today, I explored a new concept in Python — Tuples! 🐍 Tuples are used to store multiple values in a single variable, just like lists, but with one major difference: 👉 Tuples are immutable, which means their values cannot be changed after creation. Python provides several useful operations for tuples such as: 🔹 Accessing elements using indexes 🔹 Slicing to get a portion of the tuple 🔹 Finding the length using len() I also learned two important tuple methods: 🔹 count() → returns how many times a value appears 🔹 index() → returns the position of a value Tuples are faster, more secure, and perfect for storing fixed data. Learning tuples helps in writing cleaner, safer, and more efficient programs! 💡💻 LogicWhile #Day9 #Python #Tuples #LearnPython #PythonBasics #CodingJourney #PythonProgramming #TechLearning #ImmutableData #PythonForBeginners #CodeEveryday #Developers #ProgrammingCommunity #StudyPython #CodeWithMe #100DaysOfCode 🚀
To view or add a comment, sign in
-
🔥 Day 97 of #100DaysOfDSA – Counting Bits 💡 📌 Problem. no 338: For every number from 0 to n, count the number of 1s in its binary representation and return the list of counts. An elegant way to connect bit manipulation with loop optimization! ⚙️ 🚀 Runtime: 15 ms – Beats ⚡46.30% of Python submissions 💾 Memory: 17.81 MB – Beats 48.48% 💻 Language: Python ✅ Result: Accepted – 15 / 15 test cases passed 🎯 🔑 Key Learnings ✔️ Binary representation is a powerful yet simple way to analyze integer patterns ✔️ Python’s built-in functions like bin() and .count() simplify complex operations ✔️ Clean loops and logic always make debugging easier 💡 Day 97 — Simplicity in Bits, Power in Logic! 🔢 #100DaysOfCode #100DaysOfDSA #LeetCode #PythonProgramming #DataStructures #AlgorithmPractice #CodeNewbie #DailyCoding #ProblemSolving #TechJourney #WomenWhoCode #CodeLife #CodingChallenge #DSAChallenge #DeveloperLife #PythonDeveloper #LearnToCode #CodingCommunity #CodeEveryday #SoftwareEngineering #KathirCollegeOfEngineering #KathirCollege #BTechLife #AIDS #FutureEngineer #CodingMotivation #ProgrammingSkills
To view or add a comment, sign in
-
-
🐍Python Day 3 Each day, the logic gets tougher, but so does my clarity. 🔹 What I Tried: I wanted to take yesterday’s logic and make it work across multiple numbers instead of just one. 🔹 What I Built: A Python program that: ✅ Generates numbers within a range ✅ Checks if they’re even, odd, positive, or negative ✅ Detects prime numbers efficiently using the √n trick 🔹 What I Learned: Even a small piece of code can teach how to think systematically — to break a big problem into smaller parts and optimize as you go. Coding truly shapes how you feel, not just what you type. 🔹 What Was Challenging: Getting the prime number logic right without unnecessary loops. It took a few test runs (and print statements), but it finally clicked. Each day, a new script. Each script is a new insight. On to the next challenge! #PythonJourney #100DaysOfCode #LearnToCode #WomenWhoCode #CodingCommunity #PythonForBeginners #ProblemSolving #TechLearning #CodeNewbie #LogicBuilding #KeepLearning
To view or add a comment, sign in
-
-
Just stumbled on MindsDB – a federated query engine for AI that basically lets you treat any ML model like a regular SQL table. 🤯 It’s all Python, super easy to plug into existing pipelines and you can run predictions right from your DB without writing extra code. With 36.6k ⭐ it’s clearly loved. If you’ve been wrestling with model‑deployment pain, give it a spin – it might be the only MCP server you ever need. https://lnkd.in/dxd2B2nS #Python #Programming #mindsdb #Trending
To view or add a comment, sign in
-
-
🧠 Day 38 / 100 – Recursion: Factorial of a Number (LeetCode-#509) Today’s challenge was all about recursion — one of the most elegant concepts in programming. I revisited the Factorial problem, which beautifully demonstrates how a big problem can be broken into smaller subproblems. The idea is simple: 👉 The factorial of n is n * factorial(n-1) until n becomes 1. But the real challenge lies in understanding the flow of recursive calls and how the call stack unwinds to give the final result. This problem reminded me that recursion isn’t just about repeating a function — it’s about trusting the process and thinking in terms of smaller steps to solve complex problems. 🔍 Key Learnings Every recursive function must have a base case to prevent infinite loops. The call stack stores each recursive call until it’s resolved. Recursion is a natural fit for problems that can be divided into smaller, similar subproblems. 💭 Thought of the Day Recursion teaches patience and structure. Sometimes, you need to trust that solving the smaller version of a problem will help you conquer the big one — both in code and in life 💫. 🔗 Reference Problem:https://lnkd.in/g3yNGDbJ #100DaysOfCode #Day38 #LeetCode #Python #Recursion #Factorial #ProblemSolving #CodingChallenge #Algorithms #ProgrammingMindset #DataStructures #CleanCode #LearnByDoing #TechGrowth #PythonProgramming
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