💻 Day 61 of #100DaysOfCode — When Brute Force Meets Patience 🐍🧠 Today’s coding adventure: solving the “Little Professor” problem from CS50’s Python course 🎓 What started as a simple arithmetic challenge quickly turned into a full-on debugging saga. 😅 I went full brute force mode ⚔️ — breaking everything down step by step: 🔹 Generated random integers 🔹 Checked sums and conditions 🔹 Split the logic into smaller, testable parts Everything worked great… ✅ All test cases passed — except one. 💀 After a long stare at my terminal (and a few cups of chai ☕), I realized the issue wasn’t logic — it was presentation. My program was outputting the numbers in block-style lists instead of clean, streamlined sequences. Fixed it by generating the numbers one by one ➡️, and just like that — 💥 ALL TESTS PASSED! 🎯 This reminded me once again — 👉 Sometimes, it’s not your code that’s wrong… It’s the tiny overlooked detail that’s making all the noise. Every bug teaches patience. Every fix teaches precision. And every solved problem? That’s pure dopamine. ⚡🐍 #100DaysOfCode #Python #CS50 #Programming #ProblemSolving #Debugging #SoftwareEngineering #LearningInPublic #BuildInPublic #CodeNewbie #TechJourney #DeveloperLife #CleanCode #LogicBuilding #SoftwareDevelopment #DataStructures #Algorithms #CodingChallenge #FullStackDeveloper #AI #DeveloperCommunity #CodingIsFun #CodingMotivation #WebDevelopment #IndiaTech #PythonProjects
More Relevant Posts
-
When Your Function Decides to Call Itself You ever write a function… and then watch it call itself like it’s trying to have a deep conversation about purpose? That’s recursion. It’s a magical (and slightly chaotic) moment. The first time I understood recursion, I felt like I’d unlocked a cheat code in programming. It’s not just about loops or maths, it’s about trust. You trust your function to handle a smaller version of the same problem without losing its mind halfway. Example: def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) Recursion taught me patience. Both in code and in life, because sometimes, solving something big just means breaking it into smaller, saner bits and trusting the process to resolve itself. #Programming #Python #Recursion #CSHumor #CodingLife
To view or add a comment, sign in
-
-
Day 39 / 100 – Combination Sum (LeetCode #39) Today’s challenge was Combination Sum, a classic problem that teaches how to explore all possible combinations that add up to a target. The key idea here is recursion with backtracking — trying different paths, and “undoing” choices when they don’t lead to a solution. At first, it felt complex to keep track of combinations without duplicates, but recursion made it elegant once I understood how to structure the calls properly. It’s a great example of how backtracking mirrors human problem-solving: try, fail, and refine until success. 🔍 Key Learnings Recursion helps break complex problems into smaller, reusable patterns. Backtracking avoids unnecessary computation by pruning invalid paths early. Always remember to copy the current combination when adding it to results — lists are mutable! 💭 Thought of the Day Sometimes the most powerful solutions come from simplicity — recursion mirrors the way we naturally think through problems step by step. Today’s problem reminded me that patience and clarity often lead to clean, beautiful solutions ✨ 🔗 Problem Link: https://lnkd.in/gxtE573Z 🏷️ #100DaysOfCode #Day39 #LeetCode #Python #Recursion #Backtracking #ProblemSolving #Algorithms #DataStructures #CodingChallenge #LearnToCode #CleanCode #MindsetMatters #CodeEveryday #TechJourney
To view or add a comment, sign in
-
-
🗓 Day 12 / 100 – #100DaysOfLeetCode 📌Problem 3234: Count the Number of Substrings With Dominant Ones A substring is considered to have dominant ones if: Number of 1s ≥ (Number of 0s)² The challenge was to count how many substrings in the binary string satisfy this condition. 🧠 My Approach: Iterated through substrings while tracking zero count and one count. Used the condition ones ≥ zeros² to determine validity. Applied early stopping when zeros became large, since the condition becomes much harder to meet as zeros grow. This pruning helped avoid unnecessary checks and made the approach more efficient. 💡 Key Learning: This problem highlights how mathematical constraints can simplify substring evaluation. Understanding how zeros grow quadratically in the condition helped shape a smarter, more optimized checking approach rather than brute-force enumeration. A great exercise in reasoning about substring properties and designing early-exit logic. Consistent effort… consistent progress 🚀 #100DaysOfLeetCode #LeetCodeChallenge #Python #ProblemSolving #BinaryStrings #StringAlgorithms #Optimization #LogicBuilding #DataStructures #Algorithms #DSA #CompetitiveProgramming #CodingJourney #SoftwareEngineering #LearningInPublic #TechStudent #DeveloperJourney #CareerGrowth #CodeEveryday #CodingCommunity #KeepLearning #Programmer
To view or add a comment, sign in
-
-
🔹 Day 5 of 30 – LeetCode Challenge: Longest Increasing Subsequence 📈 Today’s problem was all about finding patterns and optimizing logic! I solved the Longest Increasing Subsequence (LIS) problem — a fundamental concept in Dynamic Programming and Binary Search optimization. 🧩 Problem: Given an array of integers, find the length of the longest subsequence where each element is strictly greater than the previous one. Example: Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation: [2,3,7,101] is the longest increasing subsequence. 💡 Approach: There are two ways to solve this: 1. Dynamic Programming (O(n²)) a. For each element, look back at all previous elements. b. Update dp[i] as the length of the LIS ending at that index. 2.Binary Search Optimization (O(n log n)) a. Maintain a list sub representing potential increasing subsequences. b. Use bisect_left to replace elements efficiently. ⚙️ Complexity: Time: O(n log n) Space: O(n) 🏆 Result: ✅ All test cases passed ⚡ Optimized solution using Binary Search 💪 Strengthened understanding of Dynamic Programming and Binary Search combination 💬 Learning: This problem helped me understand how to convert a quadratic DP approach into a logarithmic one by thinking about sorted subsequences and binary search placements — a powerful pattern for future optimization problems. #Day5 #LeetCode #DynamicProgramming #BinarySearch #Python #Algorithms #DataStructures #30DaysOfCode #MTech #CodingChallenge #LIS
To view or add a comment, sign in
-
-
📌 Problem. no 179: Given a list of non-negative integers, arrange them such that they form the largest possible number. Solved using a custom comparator to sort numbers based on concatenation order and achieve the optimal result. ⚡ Runtime: 3 ms – Beats 78.56% of submissions 💾 Memory: 12.69 MB – Beats 24.66% of solutions 💻 Language Used: Python ✅ Status: Accepted – All 235 test cases passed successfully! This problem enhanced my understanding of string-based comparison, custom sorting, and optimization through logic-based ordering. It’s an elegant challenge that blends sorting and string manipulation seamlessly. 🔑 Key Learnings: ✔️ Learned how to design and implement custom comparators ✔️ Understood how concatenation order affects numeric outcomes ✔️ Strengthened my grasp on sorting logic and greedy approaches 🎯 Day 84 — A creative challenge that refined my problem-solving through custom sorting and logical structuring! 🚀🔥 #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
-
-
Day:84/100 Dictionaries section-2✅️ #100daysofcodingchallenge Dictionaries: ✔️ Key-value pairs: Dictionaries store data in key-value pairs. ✔️ Mutable: Dictionaries are mutable, meaning they can be modified after creation. ✔️ Defined using curly brackets: Dictionaries are defined using curly brackets `{}`. ✔️ Fast lookups: Dictionaries provide fast lookups, with an average time complexity of O(1). ✔️ Key uniqueness: Dictionary keys must be unique. ✔️ Value flexibility: Dictionary values can be of any data type. Methods: 🔸️.keys(): Returns a view object that displays a list of all keys. 🔸️.values(): Returns a view object that displays a list of all values. 🔸️.items(): Returns a view object that displays a list of all key-value pairs. #Nxtwave #Intensive #100dayscoding #Python #Tech #coding #Programming #TechSkills #CareerDevelopment #DataLiteracy #BusinessIntelligence
To view or add a comment, sign in
-
Day:85/100 Dictionaries Section-3✅️ #100daysofcodingchallenge Dictionaries: ✔️ Key-value pairs: Dictionaries store data in key-value pairs. ✔️ Mutable: Dictionaries are mutable, meaning they can be modified after creation. ✔️ Defined using curly brackets: Dictionaries are defined using curly brackets `{}`. ✔️ Fast lookups: Dictionaries provide fast lookups, with an average time complexity of O(1). ✔️ Key uniqueness: Dictionary keys must be unique. ✔️ Value flexibility: Dictionary values can be of any data type. Methods: 🔸️.keys(): Returns a view object that displays a list of all keys. 🔸️.values(): Returns a view object that displays a list of all values. 🔸️.items(): Returns a view object that displays a list of all key-value pairs. #Nxtwave #Intensive #100dayscoding #Python #Tech #coding #Programming #TechSkills #CareerDevelopment #DataLiteracy #BusinessIntelligence
To view or add a comment, sign in
-
🔹 Day 6 of 30 – LeetCode Challenge: Longest Common Subsequence 🔠 Today’s challenge was all about finding the Longest Common Subsequence (LCS) between two strings — one of the most important problems in Dynamic Programming. 🧩 Problem: Given two strings text1 and text2, find the length of their longest subsequence that appears in both. A subsequence keeps the order of characters but doesn’t require them to be consecutive. Example: Input: text1 = "abcde", text2 = "ace" Output: 3 Explanation: LCS = "ace" 💡 Approach: I used a Dynamic Programming table where: dp[i][j] = LCS length between text1[0:i] and text2[0:j] If characters match → 1 + dp[i-1][j-1] Else → max(dp[i-1][j], dp[i][j-1]) ⚙️ Complexity: Time Complexity: O(m × n) Space Complexity: O(m × n) 🏆 Result: ✅ All test cases passed 💡 Improved understanding of 2D DP table formulation 📚 Learned how to build relationships between subproblems 💬 Learning: The LCS problem is the foundation for many advanced algorithms like Edit Distance, Diff Tools, and DNA sequence alignment. It’s a great exercise to visualize how dynamic programming connects overlapping subproblems! #Day6 #LeetCode #DynamicProgramming #LCS #Python #Algorithms #DataStructures #30DaysOfCode #CodingChallenge #MTech
To view or add a comment, sign in
-
-
Day:87/100 Dictionaries Foundations exam✅️ #100daysofcodingchallenge Dictionaries: ✔️ Key-value pairs: Dictionaries store data in key-value pairs. ✔️ Mutable: Dictionaries are mutable, meaning they can be modified after creation. ✔️ Defined using curly brackets: Dictionaries are defined using curly brackets `{}`. ✔️ Fast lookups: Dictionaries provide fast lookups, with an average time complexity of O(1). ✔️ Key uniqueness: Dictionary keys must be unique. ✔️ Value flexibility: Dictionary values can be of any data type. Methods: 🔸️.keys(): Returns a view object that displays a list of all keys. 🔸️.values(): Returns a view object that displays a list of all values. 🔸️.items(): Returns a view object that displays a list of all key-value pairs. #Nxtwave #Intensive #100dayscoding #Python #Tech #coding #Programming #TechSkills #CareerDevelopment #DataLiteracy #BusinessIntelligence
To view or add a comment, sign in
Explore related topics
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