🚀 Day 12/100: Scope & The Number Guessing Game! 🎯🔢 💡 Did you know? In the early days of computing, managing "Scope" was one of the biggest causes of system crashes. Today, understanding where your variables "live" is the secret to writing bug-free, professional code! I’ve hit Day 12 of #100DaysOfCode! Today was a deep dive into the internal mechanics of Python, specifically Global vs. Local Scope. Key technical takeaways: ✅ Scope Hierarchy: Understanding that variables created inside a function are local to that function. ✅ Global Constants: Learning the best practice of using UPPERCASE for global constants that don't change. ✅ Game Logic: Building a "Number Guessing Game" with Difficulty Levels (Easy vs. Hard). ✅ Namespace: Learning how Python tracks names to avoid variable conflicts. Mastering Scope is like mastering your internal energy—if you don't control where it flows, your whole program can fall apart! 🛡️ Check out my code here: 🔗 https://lnkd.in/gBZgiBxr The grind is getting intense. Day 13, show me what you've got! ⚔️ #Python #100DaysOfCode #ProgrammingLogic #VariableScope #CleanCode #CodingChallenge #DevCommunity
More Relevant Posts
-
🚀 Day 50 of My Coding Journey Today, I explored powerful NumPy operations — sum() and prod() — and learned how combining them can solve interesting problems efficiently. 🔍 What I learned: sum(axis=0) → adds elements column-wise prod() → multiplies elements together By combining both, we can transform and reduce arrays in a single flow 💡 Problem Insight: Given a 2D array, 👉 First, compute the column-wise sum 👉 Then, find the product of that result 📌 Example: Input: 2 2 1 2 3 4 Step 1: Sum along axis 0 → [4, 6] Step 2: Product → 4 × 6 = 24 ✨ Key Takeaway: Understanding how axes work in NumPy makes complex operations simple and efficient. 💻 Code Snippet: import numpy as np n, m = map(int, input().split()) arr = [list(map(int, input().split())) for _ in range(n)] my_array = np.array(arr) result = np.prod(np.sum(my_array, axis=0)) print(result) 🔥 Day 50 done! Staying consistent and learning something new every day. #Day50 #Python #NumPy #CodingJourney #LearningEveryday
To view or add a comment, sign in
-
-
🚀 Day 92 of #100DaysOfLeetCode 🔥 Solved: 120. Triangle (Medium) Today’s problem was all about finding the minimum path sum from top to bottom in a triangle. At each step, you can move to adjacent numbers in the next row. 💡 Key Insight: Instead of exploring all paths (which is costly), I used Dynamic Programming (Bottom-Up approach): - Start from the second row - Update each element by adding the minimum of the two possible parents - Final answer = minimum value in the last row 🧠 Why this works: We reuse previously computed results, reducing time complexity significantly. ⚡ Complexity: - Time: O(n²) - Space: O(1) (in-place modification) 💻 What I learned: - How to optimize recursive problems using DP - Importance of in-place updates for space efficiency - Clear understanding of adjacent state transitions 📈 Result: ✅ Accepted ⏱ Runtime: 3 ms 💾 Memory: 20.13 MB Consistency > Motivation. Showing up daily 💪 #Day92 #LeetCode #DynamicProgramming #CodingJourney #100DaysOfCode #DSA #Python #ProblemSolving
To view or add a comment, sign in
-
-
🔥 Day 8/100 of My LeetCode Challenge — 0 ms (100%) 🔥 Hook: Most people fail this “easy” problem because they ignore one tiny detail — can you spot it? 💭 Problem: Add 1 to a number represented as an array of digits. Sounds simple, right? But here’s the catch 👇 👉 What if the last digit is 9? 👉 What if ALL digits are 9? Example: [9,9,9] → [1,0,0,0] 💥 🧠 What I learned today: Always think about edge cases Simple problems can hide tricky logic Traversing backwards can simplify carry problems ⚡ My Approach: Start from the end If digit < 9 → add 1 and return If digit == 9 → make it 0 and continue If all become 0 → add 1 at front 💻 Result: ✅ Runtime: 0 ms (100%) ✅ Clean & optimized solution 📈 Consistency Check Day 8 complete. No excuses. No breaks. Small wins daily → Big results later 🚀 #LeetCode #Day8 #CodingJourney #Python #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🗓 7 April 2026 🚀 LeetCode #703 – Kth Largest Element in a Stream Solved this problem using a clean and efficient Min Heap approach 🔥 💡 Instead of storing all elements, I maintained only the top K largest elements, which makes the solution scalable for large data streams. 🧠 Approach: • Created a min heap • Added elements in the constructor • If size exceeds k → removed the smallest element • In add(): – Push new value into heap – Pop if size exceeds k – Return the top element (Kth ) ⚡ Time Complexity: O(n log k) 📦 Space Complexity: O(k) 💭 Key Insight: We don’t need to store all elements — just maintain the top k elements. The smallest among them is the answer 🎯 #LeetCode #DSA #Python #Coding #100DaysOfCode #Heap
To view or add a comment, sign in
-
-
🚀 Day 60/60 of #60DaysOfCode Completed the problem “Buildings with Sunlight” from . 🌇 Problem: Given heights of buildings, count how many receive sunlight from the left side. A building gets sunlight only if no taller building exists before it. 💡 Approach: Traverse from left and track the maximum height so far: - If current height ≥ max → it gets sunlight - Update max height 🧠 Key Learning: A simple greedy approach can solve this efficiently in one pass. 💻 Code: class Solution: def visibleBuildings(self, arr): max_height = 0 count = 0 for h in arr: if h >= max_height: count += 1 max_height = h return count ⚡ Complexity: - Time: O(n) - Space: O(1) Consistency paid off — 60 days strong 💪 Next target: bigger challenges 🚀 #Day60 #60DaysOfCode #Python #DSA #Greedy #ProblemSolving #CodingJourney #GeeksforGeeks
To view or add a comment, sign in
-
-
LeetCode Day 13 – Container With Most Water Today I solved the classic “Container With Most Water” problem — a great example of optimizing from brute force to an efficient solution! Problem Insight: We are given an array of heights, and we need to find two lines that together with the x-axis form a container that holds the maximum water. Approaches: Brute Force (O(n²)) Check all possible pairs Calculate area = width × min(height[i], height[j]) Keep track of maximum Optimal Approach – Two Pointer (O(n)) Start with two pointers at both ends Calculate area Move the pointer with smaller height inward Repeat until pointers meet Key Idea: The limiting factor is always the smaller height Moving the larger height won’t help increase area Complexity: Time: O(n) Space: O(1) What I learned: How two-pointer technique drastically reduces complexity Importance of understanding constraints before coding #LeetCode #Day13 #DSA #CodingJourney #Python #TwoPointers #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Just built and published my first open-source CLI tool — longcat-sgpt! It's a Shell GPT for the terminal powered by LongCat AI. Ask questions, generate shell commands, explain errors, and pipe any file into it — all from your terminal. 🔧 Built with Python 📦 Installable via pip 🐙 Open source on GitHub 🪙 5M Tokens Limit ✍️ Writes the command directly in CLI Link : pip install git+https://lnkd.in/dmAqCTjY Always learning, always building. 💻 #Python #OpenSource #CLI #AI #Linux
To view or add a comment, sign in
-
🚀 Day 83 of #100DaysOfCode 📌 Problem Solved: Letter Combinations of a Phone Number (LeetCode 17) Today’s challenge was all about exploring backtracking and how recursive decision-making builds combinations efficiently. 🔍 Given a string of digits (2–9), the goal is to generate all possible letter combinations based on the classic phone keypad mapping. 💡 Key Learning: Instead of trying every possible string blindly, backtracking helps us build combinations step-by-step and explore only valid paths — making the solution clean and efficient. ⚡ Highlights: ✔️ Used recursion to explore all possibilities ✔️ Implemented a digit-to-letter mapping ✔️ Built combinations incrementally ✔️ Achieved optimal runtime performance 📈 Result: ✅ All test cases passed ⚡ 0 ms runtime (Beats 100%) Consistency is starting to compound — one problem at a time. 💪 #LeetCode #DSA #Python #CodingJourney #Backtracking #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 78 – Diving Deeper into Randomness & Voice in Python 🎙️✨ Today’s exploration added more exciting tools to my Python journey: 🔹 Random Module (Advanced Functions) – Practiced uniform(), choices(), and sample() to generate floating‑point randomness, weighted selections, and unique subsets. These functions showed how randomness can be fine‑tuned for simulations, games, and creative problem‑solving. 🔹 Text‑to‑Speech with pyttsx3 – Learned how to install and use this library to convert text into voice. It was fascinating to see code literally speak back, opening doors to accessibility features, interactive applications, and fun projects. 🌱 Reflection – Randomness taught me that unpredictability can be controlled with precision, while text‑to‑speech reminded me that code can connect with people in more human ways. Together, they highlight how programming bridges logic and creativity. ✨ Grateful to Rudra Sravan kumar sir and the 10000 Coders team for guiding me through these practical concepts that make coding more engaging and versatile. ⚡ Day 78 was about giving code a voice and mastering randomness with purpose — skills that make applications dynamic, interactive, and impactful. #Day78 #PythonLearning #RandomModule #pyttsx3 #CodingJourney #10000Coders #LearnInPublic #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 3 of #14DaysOfPython 🐍 Today’s focus: Loops (Iteration Mastery) — where automation really begins. 💡 Easy way to understand loops: 🔹 Why loops? 👉 When you need to repeat a task multiple times instead of writing code again and again 💡 Core Concepts (Logic First): 🔹 for loop vs while loop for → when you know how many times to run while → when condition decides 🔹 range() variations range(n) → 0 to n-1 range(start, end) range(start, end, step) 🔹 Loop control break → stop loop immediately continue → skip current step pass → do nothing (placeholder) 🔹 Infinite loop ⚠️ 👉 Happens when condition never becomes false 🔹 Iteration patterns 👉 Numbers, strings, lists — everything can be looped 🧠 Problems I practiced: Sum of digits Reverse a number Factorial Count occurrences ✨ Key takeaway: Loops are not about syntax — they are about thinking in repetition and patterns. Day 3 done ✅ Moving to Day 4 💪 #Python #HackerRank #CodingJourney #LearningInPublic #ProblemSolving #DeveloperJourney #100DaysOfCode#codegnan
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