🧠 LEETCODE CONSISTENCY SERIES 🚀 Day 🔟 of 365 Days 🔁 📘 Topic: Math + Greedy 🧩 Problem: Integer to Roman (LeetCode #12) ⏱ Time Taken: ~25 minutes 💡 Key Idea: Roman numerals are built from highest to lowest values Use a greedy approach: always subtract the largest possible Roman value Handle subtractive cases (IV, IX, XL, XC, CD, CM) explicitly 🔑 Important Technique Used: Value–Symbol mapping with ordered traversal Repeated subtraction using while loop 🚀 What I learned today: Why subtractive notation exists only for specific values How greedy algorithms simplify complex-looking rules Clean mapping makes logic readable and bug-free 📌 Next goal: Solve more Math + Greedy problems to improve pattern recognition Consistency > Motivation 💪 🔗 GitHub: https://lnkd.in/dRGB_B8Z #DSA #LeetCode #Python #ProblemSolving #365DaysOfCode #CodingJourney #GreedyAlgorithm
LeetCode Consistency Series: Integer to Roman #12
More Relevant Posts
-
Don't Estimate Effects When You Only Care About Ranking In this week's issue of Causal Python Weekly: - A brand-new paper by Henri Arno and colleagues shows why we might fail when using CATE estimators for ranking and how to do better - The results of our Best of Causality Survey 2025 are finally here! - An upcoming Rethinking How We Choose Statistical Tests Challenge - Ellis Award for Zhijing Jin for her work on causality & LLMs -------- We'll start sending today's issue at 9am PT / 12pm ET / 6pm CET (Sunday) You can subscribe here (it's free): https://causalpython.io
To view or add a comment, sign in
-
-
🧩 Problem Solved: Square Root of a Number (LeetCode #69) 💡 Concept Learned: This problem helped me understand that Binary Search is not only for finding a target, but also for finding the best possible value that satisfies a condition. Instead of checking every number, I searched within a range and narrowed it down efficiently. 🔍 Key Insight: The square root of a number x lies between 0 and x. At each step: If mid × mid is greater than x, the value is too large → move left If mid × mid is less than or equal to x, it’s a valid answer → try a bigger value When the search ends, the correct answer is the largest number whose square is ≤ x. 🎯 What I Learned: How binary search works on an answer range Why boundary values (left, right) matter How to think beyond “find the target” problems ⏱ Time Complexity: O(log n) 📦 Space Complexity: O(1) 📈 Slowly building confidence by solving problems step by step and strengthening my fundamentals. Consistency over perfection 🚀 #DSA #LeetCode #BinarySearch #Python #ProblemSolving #LearningInPublic #CodingJourney #NeverGiveUp
To view or add a comment, sign in
-
-
hi connections I just tackled LeetCode 53: Maximum Subarray using Kadane’s Algorithm. There’s something so satisfying about mapping out the logic by hand before hitting the keyboard. The core decision at every index? ✅ Start fresh: Is the current number bigger than the total sum so far? ✅ Keep going: Does adding the current number improve the streak? My logic: maxSum: Decides whether to restart or continue the subarray. maxSumSoFar: Tracks the "all-time high" score. Quick Tip: Watch out for variable names! I spent a minute debugging a NameError because my notes said a, but the function expected nums. Even the best logic needs a bit of syntax TLC. Efficiency: Time: O(n) Space: O(1) #SoftwareEngineering #LeetCode #Coding #Python #Algorithms #ProblemSolving
To view or add a comment, sign in
-
-
🔥 Tool Calling Guide for Local LLMs from Unsloth AI Guide: https://lnkd.in/gaC7Z58v - Qwen3-Coder-Next - GLM-4.7 - Kimi K2.5 - DeepSeek-V3.1/3.2 - Minimax - gpt-oss - NVIDIA Nemotron 3 Nano - Devstral 2 #toolcalling #ai #LLMs #localai #tutorial #recipe #privacy #openweights #models
We created a tool-calling guide for local LLMs! 🛠️ Learn how to use open models like Qwen3-Coder-Next and GLM-4.7-Flash for function calling. Has hands-on examples for: story writing, Python execution, terminal tool calls, maths and more. Unsloth AI Guide: https://lnkd.in/gDCZJN7b
To view or add a comment, sign in
-
-
Struggling to determine the smallest possible number after removing K digits? The key insight lies in using a Monotonic Stack. I recently worked through the Remove K Digits problem, which is a classic greedy algorithm challenge. The intuition is straightforward: to minimize a number, smaller digits should appear as early as possible. By maintaining a stack in non-decreasing order and removing larger digits when a smaller digit is encountered, we can systematically construct the smallest valid result. This approach achieves an optimal O(n) time complexity. Key takeaways: - Use a stack to maintain digits in increasing order. - If removals remain after traversal, pop digits from the end. - Always handle leading zeros in the final result. This problem is an excellent example of how digit position directly impacts numerical value and highlights the power of greedy strategies combined with the right data structure. Code Implementation: https://htmlify.me/r/xqfx #Coding #Algorithms #DataStructures #Python #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
❄️ takeUforward — Day 25 ✅ Search Insert Position | Arrays | LeetCode Today I solved the Search Insert Position problem, which focuses on understanding array traversal and positioning logic in a sorted array. 🧩 Problem Statement Given a sorted array nums and a target value target, return the index if the target is found. If not, return the index where it would be inserted in order. ⚡ Approach — Linear Scan 💡 Idea • Traverse the array from left to right. • As soon as an element is greater than or equal to the target, return its index. • If the target is larger than all elements, insert it at the end. . Complexity • Time: O(n) • Space: O(1) 📌 Key Learning Even simple problems strengthen fundamentals. This problem highlights how clear conditions and early returns can make solutions efficient and readable. 🚀 Day 25 completed — reinforcing array fundamentals and edge-case handling. #DSA #DataStructures #Algorithms #Python #LeetCode #CodingJourney #ProblemSolving #InterviewPreparation #LearnInPublic #Consistency
To view or add a comment, sign in
-
-
🧮 Just out: a book that supplements the existing bibliography concerning single-variable calculus, and provides material including Python code for both symbolic and approximate computations. Author, Nikolaos Halidias, uses AI to produce codes, and shows the reader the "how-to" behind it. To learn more about this new textbook, read here, https://lnkd.in/dHbBw6-C
To view or add a comment, sign in
-
-
🚀 LeetCode Daily Progress | problem number 12 | Tree DFS 🌳 Solved LeetCode 129: Sum Root to Leaf Numbers today. 🔹 The idea was simple yet powerful: While traversing from root to leaf, build the number using current = current * 10 + node.val. 🔹 Whenever a leaf node is reached, the formed number is added to the total sum. 💡 This problem reinforced: Depth-First Search (DFS) Passing state through recursion How trees can represent real numeric problems elegantly On to the next one — consistency over motivation 💪 #LeetCode #DSA #BinaryTree #DFS #Python #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
i have updated the ml-from-scratch repo and added a new section gradient-descent. it was worth looking back and doing things from scratch and i enjoyed it all along. The linear algebra and how the python automatically converts (n, ) matrix to (n,n) was something new to me. look at the repo and do lmk what else i can do, though i have planned to build sgd and mini-gd too. the repo: https://lnkd.in/gsy9mn_e
To view or add a comment, sign in
-
🚀Day 33 of #100DaysOfCode 📌 LeetCode 110 – Balanced Binary Tree Today I solved the Balanced Binary Tree problem, which checks whether a binary tree is height-balanced. 👉 A binary tree is considered balanced if for every node, the height difference between its left and right subtrees is at most 1. 💡 Key Learning Instead of recalculating heights repeatedly (which is inefficient), I used a bottom-up DFS approach: Return the height of a subtree if it’s balanced Return -1 immediately if an imbalance is detected This helps in early stopping and keeps the solution optimal. ⚙️ Complexity Time: O(n) Space: O(h), where h is the height of the tree 🧠 Takeaway Optimizing recursive solutions by combining checks with return values can significantly improve performance and clarity. Consistency > Motivation 💪 On to the next problem! #LeetCode #DataStructures #BinaryTree #Python #CodingJourney #ProblemSolving #100DaysOfCode #LearningEveryDay
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