🚀 𝗗𝗮𝘆 𝟮𝟯/𝟯𝟬 — 𝗗𝗦𝗔 𝗖𝗵𝗮𝗹𝗹𝗲𝗻𝗴𝗲 Day 23 and continuing deeper into graph problems. The interesting part about graphs is how many real-world systems they represent — networks, dependencies, routes, and connections. Problems start to feel more like exploring a map than just working through a list. Today’s focus was on using traversal techniques to explore nodes and understand relationships between them. 🔎 𝗗𝗮𝘆 𝟮𝟯 𝗙𝗼𝗰𝘂𝘀 • Strengthening DFS and BFS traversal • Understanding how to track visited nodes • Solved: ✅ Clone Graph ✅ Course Schedule ✅ Rotting Oranges Graph problems definitely require careful thinking, but it’s satisfying when the traversal logic finally clicks. On to Day 24 #DSA #Python #LeetCode #Consistency #SoftwareEngineering #ProblemSolving
Day 23: Graph Traversal Techniques and LeetCode Solutions
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 3 / 100 🚀 Solved “Reverse Integer” — a problem that looks simple but actually tests how carefully you handle edge cases. At first, reversing digits feels straightforward. But the real challenge is handling 32-bit overflow without using extra space. 💡 Key learning: Before updating the result, always check if multiplying by 10 will exceed the allowed range. Core idea: rev * 10 + digit must stay within [-2³¹, 2³¹ - 1] Highlights: • Time Complexity: O(log n) • Space Complexity: O(1) • Correctly handles negative numbers and overflow This problem reinforced a critical habit: Don’t just make the logic work — validate boundary conditions. #100DaysOfCode #LeetCode #DSA #Python #ProblemSolving #CodingInterview
To view or add a comment, sign in
-
-
🚀 DSA Practice Update! Solved Remove Duplicates from Sorted Array on LeetCode with an optimized approach. Brute Force: O(n log n) time | O(n) space Optimized (Two Pointer):O(n) time | O(1) space Choosing the right approach matters more than just solving the problem. The Brute Force approach removes duplicates by using extra data structures like a set and then sorting the array again. Because of sorting, its time complexity becomes O(n log n) and it also requires O(n) extra space. Additionally, it is not in-place, which makes it less efficient and not ideal for optimized solutions. “I used a two-pointer approach where one pointer tracks the position of unique elements and the other scans the array. This gives O(n) time and O(1) space complexity.” Consistency + Optimization = Growth 📈 #DSA #LeetCode #InterviewPrep #Python #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 55 of #100DaysOfCode Solved LeetCode 350 – Intersection of Two Arrays II today! 🔍 Problem Insight: Given two arrays, we need to return their intersection such that each element appears as many times as it occurs in both arrays. 💡 Approach Used: - Used "Counter" (hash map) to store frequency of elements from first array - Traversed second array and matched elements - Reduced count after every match to handle duplicates correctly ⚡ Why this works: Efficient frequency tracking avoids nested loops and reduces time complexity. 🧠 Complexity: - Time: O(n + m) - Space: O(n) ✅ Key Learning: Hashing + frequency counting is powerful for problems involving duplicates and intersections. 🔥 Consistency is the key — showing up every day! #DSA #LeetCode #Python #CodingJourney #PlacementPrep #SoftwareEngineering #100DaysOfCode
To view or add a comment, sign in
-
-
LeetCode 23: Merge k sorted list: You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. Approach: Simple and straightforward, iterate through each of the linked-list in the given list, push each node's value into a priority queue using heapq module, create a new linked-list using the elements of priority queue. Time complexity: O(n logn) where n is the total number of values. Space complexity: O(n) #Python #LeetCode #DSA #CompetitiveProgramming #DataStructures #Algorithms #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Solved today’s GeeksforGeeks Problem of the Day: Minimum Height Trees using Python 🐍 Problem: Given an undirected tree, find all nodes that can be chosen as roots such that the tree has minimum possible height. Approach: Used a Topological Trimming (Leaf Removal) approach with BFS. ✔ Built adjacency list and calculated degree of each node ✔ Started with all leaf nodes (degree = 1) ✔ Removed leaves level by level ✔ Continued until ≤ 2 nodes remained ✔ Remaining nodes are the centers of the tree (answer) 💡 Key Insight: The roots that give minimum height are the center(s) of the tree, which can be found by peeling layers like an onion 🧅 💡 Concepts Used: Graph Traversal | BFS | Topological Approach | Tree Centers This problem helped me understand how tree properties can simplify complex graph problems efficiently 🌳 #geekstreak60 #npci #geeksforgeeks #dsa #python #graphs #codingpractice #problemSolving
To view or add a comment, sign in
-
-
𝗦𝗹𝗼𝘄 𝗽𝗼𝗶𝗻𝘁𝗲𝗿. 𝗙𝗮𝘀𝘁 𝗽𝗼𝗶𝗻𝘁𝗲𝗿. 𝗢𝗻𝗲 𝗲𝗻𝗱𝘀 𝗮𝘁 𝘁𝗵𝗲 𝗺𝗶𝗱𝗱𝗹𝗲. Today's problem: Middle of a Linked List on GFG 🟢 — an easy one, but worth understanding properly. Slow moves 1 step, fast moves 2. When fast hits the end, slow is at the middle — because fast covers exactly 2x the distance. The thing worth noting: while fast and fast.next aren't the same check. fast handles an empty list or fast landing on None mid-traversal. fast.next prevents fast.next.next from crashing when fast is on the last node. Same line, two different failure cases. ✅ 1115/1115 | First attempt | O(n) time, O(1) space Day 14 of #1000DaysOfLearning #DSA #Python #GFG #LearningInPublic
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 19 of #DSAPrep > Problem: Quick Sort > Concept: Divide and Conquer (Pivot & Partition) Learned Quick Sort, where an element is chosen as a pivot and the array is partitioned such that smaller elements are placed on the left and larger elements on the right. > Key Idea: - Choose a pivot element - Partition the array around the pivot - Recursively apply the same process on left and right subarrays > Time Complexity: O(n log n) > Space Complexity: O(log n) #DSAPrep #Algorithms #Python #Sorting #ProblemSolving #CodingJourney #DivideAndConquer
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