Day 35 / #120DaysOfCode – LeetCode Challenge ✅ Problem Solved: • Minimum Distance Between Equal Elements 💻 Language: Python 📚 Key Learnings: • Used HashMap (defaultdict) to store indices of elements • Learned how to track positions efficiently • Applied distance calculation between indices • Improved understanding of index-based problems • Practiced optimizing solution using O(n) approach Consistency + Practice = Progress 📈 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #HashMap #Algorithms #CodingJourney #Consistency #120DaysOfCode
Minimum Distance Between Equal Elements in Python with HashMap
More Relevant Posts
-
Day 34 / #120DaysOfCode – LeetCode Challenge ✅ Problem Solved: • Longest Harmonious Subsequence (LHS) 💻 Language: Python 📚 Key Learnings: • Used HashMap (Counter) to store frequency efficiently • Learned how to identify harmonious pairs (num & num + 1) • Improved understanding of frequency-based problems • Practiced optimizing solution using O(n) approach • Strengthened problem-solving using pattern recognition Small consistency → Big improvement 📈 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #HashMap #CodingJourney #Consistency #120DaysOfCode
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 53 🚀 – Bit Manipulation + Subsets 🔥 Exploring power sets and pattern expansion 💯 Day 53 / #120DaysOfCode – LeetCode Challenge ✅ Problem Solved: • 78. Subsets 💻 Language: Python 📚 Key Learnings: • Built subsets using iterative expansion technique • Understood relation to power set (2ⁿ combinations) • Learned alternative approach via bit manipulation • Strengthened understanding of combinatorics in coding 💡 Key Insight: Each element doubles the number of subsets → include / exclude 🔥 Progress: Moving deeper into patterns used in recursion & bit manipulation 💪 🔗 LeetCode Profile: https://lnkd.in/gbeMKcv5 #LeetCode #Python #DSA #BitManipulation #Subsets #Backtracking #Consistency #120DaysOfCode
To view or add a comment, sign in
-
-
Day 55/100 – #100DaysOfCode 🚀 Solved LeetCode #205 – Isomorphic Strings (Python). Today I practiced hashmap (dictionary) usage to check whether two strings follow the same pattern. Approach: 1) Create two hashmaps to store character mappings in both directions. 2) Traverse both strings together using zip(). 3) Check if the current mapping is consistent in both maps. 4) If any mismatch is found, return False. 5) Otherwise, update the mappings and continue. 6) If all mappings are valid, return True. Time Complexity: O(n) Space Complexity: O(n) Understanding how bidirectional mapping ensures consistency 💪 #LeetCode #Python #DSA #HashMap #Strings #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
💻 Day 4 of #100DaysOfCode Today I learned about Tuples, Sets, and Dictionaries in Python 🐍 What I covered: - Tuples and their properties - Sets and how they store unique values - Dictionaries (key-value pairs) - Difference between Lists, Tuples, and Sets I also practiced small programs to understand how each data structure works in real scenarios. This helped me understand where to use each one and how data can be stored in different ways. Learning step by step and improving daily 💪 See you all tomorrow with new learnings and more progress 🚀 #Python #100DaysOfCode #CodingJourney #Learning #Consistency
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
-
-
🚀 Day 10/30 – Python Challenge Learning about tuples in Python today! 🐍 🔹 Key Concepts Covered: * Creating tuples * Accessing elements using index * Iterating through tuple elements using loops * Understanding immutability (tuples cannot be changed) 💻 Mini Task: Created a tuple of numbers, accessed the first element, and used a loop to display all the values. 🎯 Learning Outcome: Understood how tuples are used to store fixed collections of data and how they differ from lists. They are especially useful when data should not be modified. Building a strong foundation in data structures step by step 💪 #Python #CodingChallenge #LearningJourney #DataStructures #StudentDeveloper #Day10
To view or add a comment, sign in
-
-
Day 59: Remove Spaces Task: Given a string, remove all the space characters and return the modified string. Solution: Python Built-in String Methods. Sometimes the absolute best solution is the simplest one! While you could manually iterate through the string and append non-space characters to a new string, Python makes this incredibly easy. A single line utilizing the built-in .replace(' ', '') method handles the entire operation efficiently under the hood. It’s clean, highly readable, and perfectly Pythonic! #geekstreak60 #npci #codingchallenge #dailylearning #programmer #python #strings #algorithmsNational Payments Corporation Of India (NPCI) GeeksforGeeks
To view or add a comment, sign in
-
-
Day 42/100 – #100DaysOfCode 🚀 Solved LeetCode #2574 – Left and Right Sum Differences (Python). Today I practiced prefix sum logic to calculate the absolute difference between left and right sums for each index. Approach: 1) Calculate the total sum of the array. 2) Initialize leftSum = 0. 3) Traverse the array. 4) For each index, compute rightSum = total - leftSum - nums[i]. 5) Calculate the absolute difference and append it to the result. 6) Update leftSum by adding nums[i]. Time Complexity: O(n) Space Complexity: O(n) Understanding prefix sum helps solve problems efficiently 💪 #LeetCode #Python #DSA #Arrays #PrefixSum #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Today, I learned how to take user input in Python using the input() function. This allows programs to interact with users and collect data such as name, age, and city. I also learned how to convert input into numbers using int() and float(), which is very important for calculations and data processing. #Day2 #Python #LearningJourney #DataScience #MachineLearning #Consistency
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