Day 5/100: Auctions and Stacks! 🚀 Today was all about mastering Python Dictionaries and diving into Data Structures! I built a Secret Auction Program that uses dictionary mapping to handle multiple bidders and logic to determine the highest bidder. It was a great exercise in loop control and data retrieval. On the DSA front, I officially started Stacks. 📚 Understanding the LIFO (Last In, First Out) principle and how it powers everything from function calls to the "undo" button in your favorite editor is fascinating. Key Takeaways: 1.) Implementing dictionaries for real-world data storage. 2.) The mechanics of push and pop operations in Stacks. 3.) Building cleaner, more modular code. Onward to Day 6! 💻✨ #100DaysOfCode #Python #DSA #LearningJourney #BuildInPublic #LPU
Mastering Python Dictionaries and Stacks
More Relevant Posts
-
Day 14/100 – Data Structures & Algorithms Today, I worked on the problem “First Unique Character in a String.” Overview The task is to identify the first non-repeating character in a string and return its index. If no such character exists, the result is -1. Approach I used a two-pass strategy: • First pass to store character frequencies using a hashmap • Second pass to identify the first character with a frequency of one Complexity • Time Complexity: O(n) • Space Complexity: O(1) Key Takeaway This problem reinforces how effective hashmaps are for frequency-based problems and how a simple two-pass approach can lead to optimal solutions. Staying consistent and building problem-solving intuition step by step. #Day14 #100DaysOfCode #DSA #Python #LeetCode #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 Day 16 – DSA Daily Series Today’s Problem: Two Sum II – Input Array Is Sorted (LeetCode 167) Today’s problem was simple yet really interesting — especially because of how efficiently it can be solved using the two-pointer technique. 🧠 Problem Given a sorted array, find two numbers such that they add up to a target value and return their indices (1-based). Example: Input: [2,7,11,15], target = 9 Output: [1,2] 💡 Approach Instead of using extra space like a hashmap, I used: • Two pointers — one at the start and one at the end • If sum is too large → move right pointer left • If sum is too small → move left pointer right • Stop when target is found Clean and efficient ⚡ ⏱ Complexity Time Complexity: O(n) Space Complexity: O(1) 🔎 Key Learning When the array is already sorted, always think of two pointers before anything else — it saves both time and space. Solved it today and it felt really smooth to implement! 💯 Continuing to stay consistent and improve step by step 🚀 #DSA #LeetCode #Python #TwoPointers #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 42/100 – LeetCode Challenge Solved 206. Reverse Linked List today! 🔍 Problem Summary: Given the head of a singly linked list, reverse the list and return the new head. 💡 Approach: Implemented an iterative solution using three pointers (prev, curr, next) to reverse the links efficiently in-place. Also explored the recursive approach to strengthen understanding of linked list manipulation. ⚡ Complexity: • Time Complexity: O(n) • Space Complexity: O(1) (Iterative) 📌 Key Takeaways: Importance of pointer manipulation Handling edge cases like empty list Difference between iterative vs recursive approaches Consistency is key — one step closer to mastering Data Structures & Algorithms! 💪 #LeetCode #100DaysOfCode #DataStructures #Algorithms #CodingJourney #Python #ProblemSolving #LinkedList
To view or add a comment, sign in
-
-
🚀 Day 39/60 — LeetCode Discipline Problem Solved: Sqrt(x) Difficulty: Easy Today’s challenge was to compute the square root of a number without using built-in functions. Instead of brute force, I used Binary Search — a classic, elegant approach that narrows down the answer efficiently. 💡 Key Learnings: • Binary Search application beyond arrays • Handling edge cases (x < 2) • Avoiding overflow using conditions carefully • Finding floor value of square root • Optimized thinking over brute force ⚡ Performance: Runtime: 4 ms Like walking in a foggy path, I didn’t see the answer directly… But step by step— cutting the search space in half— the truth revealed itself. That’s the beauty of algorithms. #LeetCode #60DaysOfCode #DSA #BinarySearch #ProblemSolving #CodingJourney #Python #Consistency #TechGrowth
To view or add a comment, sign in
-
-
✅ Day 74 of 100 Days LeetCode Challenge Problem: 🔹 #653 – Two Sum IV: Input is a BST 🔗 https://lnkd.in/g9vDFKMA Learning Journey: 🔹 Today’s problem required checking whether there exist two nodes in a Binary Search Tree whose values sum to k. 🔹 I performed a Depth-First Search (DFS) traversal using a stack to visit all nodes of the tree. 🔹 While traversing, I stored each node’s value in a list. 🔹 Then I used a hash set to track visited values and checked whether the complement (k - value) already exists. 🔹 If the complement is found, it means two numbers sum to k, so the function returns True. Concepts Used: 🔹 Depth-First Search (DFS) 🔹 Stack-based Tree Traversal 🔹 Hash Set for Fast Lookup 🔹 Two Sum Pattern Key Insight: 🔹 The classic Two Sum approach works well after collecting values from the BST. 🔹 Using a set allows O(1) lookup, making it efficient to check complements during iteration. Complexity: 🔹 Time: O(n) 🔹 Space: O(n) #LeetCode #Algorithms #DataStructures #CodingInterview #100DaysOfCode #SoftwareEngineering #Python #ProblemSolving #LearningInPublic #TechCareers
To view or add a comment, sign in
-
-
Today I used Cortex Code to run evaluations on my Cortex Agent and the workflow is surprisingly smooth. Cortex Code can create eval datasets, configure metrics, kick off evaluation runs, and analyze results -- all from the CLI. No context-switching between Snowsight tabs. You describe what you want to test, it writes the SQL and Python, and you iterate from there. I was able to compare accuracy and groundedness across different prompt configs in about 15 minutes. The traces show exactly where the agent went off track, which makes debugging way faster than staring at raw logs. If you're building Cortex Agents, pair them with Cortex Code for evals. Works just as well for production monitoring as it does for continual testing as you tweak prompts and configs. What's your workflow for evaluating agents as they evolve? #Snowflake #CortexCode #CortexAI #AIAgents #AIObservability
To view or add a comment, sign in
-
-
🚀 Day 39/100 – LeetCode Challenge Today’s problem: 406. Queue Reconstruction by Height This problem focuses on applying a Greedy approach with sorting to reconstruct a queue based on height and positional constraints. 🔍 Key Insight: Sort people by height in descending order and k value in ascending order, then insert each person at their respective index. 💡 What I learned: Importance of sorting strategy in greedy problems How insertion at a specific index can maintain constraints Thinking from the perspective of "who affects whom" (taller vs shorter) 🧠 Approach: Sort the array → (-height, k) Insert each person at index k 💻 Code (Python): class Solution: def reconstructQueue(self, people): people.sort(key=lambda x: (-x[0], x[1])) queue = [] for p in people: queue.insert(p[1], p) return queue ⏱️ Time Complexity: O(n²) Consistency is the key — showing up every day and improving step by step. #Day39 #LeetCode #100DaysOfCode #DSA #Python #CodingChallenge #GreedyAlgorithm #SoftwareDevelopment
To view or add a comment, sign in
-
-
✅ Day 87 of 100 Days LeetCode Challenge Problem: 🔹 #2840 – Check if Strings Can be Made Equal With Operations II 🔗 https://lnkd.in/gY73RBb5 Learning Journey: 🔹 Today’s problem extended the previous one, allowing swaps between indices where the difference is even. 🔹 I observed that this again partitions the string into two independent groups: • Even indices (0, 2, 4, …) • Odd indices (1, 3, 5, …) 🔹 I extracted characters from even and odd positions separately for both strings. 🔹 Then, I sorted these groups and compared them between s1 and s2. 🔹 If both even-index groups and odd-index groups match, the strings can be made equal. Concepts Used: 🔹 String Manipulation 🔹 Index Grouping (Parity-based) 🔹 Sorting 🔹 Greedy Observation Key Insight: 🔹 Since swaps are allowed only between indices with even distance, characters can only move within their parity group. 🔹 Therefore, the problem reduces to checking if both parity groups have identical character distributions. Complexity: 🔹 Time: O(n log n) 🔹 Space: O(n) #LeetCode #Algorithms #DataStructures #CodingInterview #100DaysOfCode #SoftwareEngineering #Python #ProblemSolving #LearningInPublic #TechCareers
To view or add a comment, sign in
-
-
Topic 4/100 🚀 🧠 Topic 4 — Generators Processing large data and running out of memory? 😵 This concept solves that problem. 👉 What is it? Generators are functions that return values one at a time using yield instead of returning everything at once. 👉 Use Case: Used in real-world applications for: Reading large files Data streaming Handling APIs with pagination 👉 Why it’s Helpful: Saves memory Improves performance Enables lazy evaluation (data generated only when needed) 💻 Example: def count_up_to(n): for i in range(n): yield i for num in count_up_to(5): print(num) 🧠 What’s happening here? Instead of storing all values in memory, the function generates them one by one when needed. ⚡ Pro Tip: If you're working with large datasets, always think “generator” before using lists. 💬 Follow this series for more Topics #Python #BackendDevelopment #100TopicOfCode #SoftwareEngineering #LearnInPublic
To view or add a comment, sign in
-
-
🚀 Day 13 of Consistency | #75DaysLeetCodeChallenge 🧠 Today’s Problem : Container With Most Water (#11) 💡 Key Learning: This problem strengthens understanding of the two-pointer optimization technique, where maximizing area depends on width & minimum height. ⚡ Approach: Use two pointers → left (l) at start & right (r) at end →Calculate area = (r - l) * min(height[l], height[r]) →Update max area →Move the pointer with smaller height (to try increasing area) 🧠 Why this works: Eliminates brute force O(n²) → optimized to O(n) Greedy movement ensures better area possibilities No extra space → O(1) 🔥 Result : ✔️ Runtime: 57 ms (Beats 60.95%) 📈 Problems like this build strong intuition for optimization & greedy thinking. Consistency is compounding. Keep going. 💪 #Day13 #LeetCode #DSA #CodingJourney #100DaysOfCode #Python #TwoPointers #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