[Data Structure and Algorithm] I solved the iconic "Two Sum" problem at LeetCode. https://lnkd.in/ehpwNnNf Solving this problem helped me in: 1. Algorithmic understanding: improve my understanding of basic algorithms and data structures, particularly array manipulation and hte use of hash maps for efficient lookups. 2. Knowing various data structure could help in improving time complexity: using two nested for loops could be inefficient (O(n^2)) in some situations. Utilizing hash map could give a more efficient result (O(n)).
Brian JongHoon Lee, FRM, CAIA’s Post
More Relevant Posts
-
🌟 Day 209 - Progress Update! 🌟 Today was all about mastering linked lists! Solved: 1️⃣ Merge Two Sorted Lists - Perfecting merge techniques for sorted data. 2️⃣ Remove Nth Node From End of List - Tackling edge cases in linked lists efficiently. Every day brings a new challenge, and every solution sharpens my understanding of data structures and algorithms. 🚀 #DataStructures #Algorithms #LearningJourney #LinkedLists #CodingLife
To view or add a comment, sign in
-
🚀 Day 44: Quick Sort on Linked List 🔍 Problem Statement: Given a linked list, the goal is to sort it using the Quick Sort algorithm. Examples: Input: 1 -> 6 -> 2 Output: 1 -> 2 -> 6 Input: 1 -> 9 -> 3 -> 8 Output: 1 -> 3 -> 8 -> 9 💡 Approach: Quick Sort is effective on linked lists as it doesn’t require random access, making it efficient for large inputs. Here, we used the partition strategy with a pivot, recursively sorting nodes around it. The key challenge was managing pointers without extra space. 🎯 Reflection: This problem reinforced my understanding of sorting on data structures without indices. Working through pointer adjustments for linked list sorting was tricky but rewarding. #CodingChallenge #DataStructures #Algorithms #LeetCode #GeeksforGeeks #100DaysOfCode #CodingJourney
To view or add a comment, sign in
-
#Day35_Blind_74_leetcode This algorithm cleverly utilizes the "slow" and "fast" pointer approach, boasting a time complexity of O(n) and a space complexity of O(1). Mastering such fundamental algorithms not only enhances problem-solving skills but also lays a solid foundation for tackling more complex challenges in the field of data structures and algorithms.
To view or add a comment, sign in
-
💡 Day 45 of #100DaysOfProgrammingChallenge 🚀 Challenge Accepted: #222 Count Complete Tree Nodes ✨ Let's dive into tree data structures with the "Count Complete Tree Nodes" challenge! 🌳 Given the root of a complete binary tree, our task is to return the number of nodes in the tree. A complete binary tree is defined such that every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. We need to design an algorithm that runs in less than O(n) time complexity. Here's a quick example to illustrate: - Input: root = [1,2,3,4,5,6] - Output: 6 Ready to tackle this problem and efficiently count the nodes in a complete binary tree? Join me in solving this intriguing challenge! 💻 #CodingChallenge #Algorithms #DataStructures #BinaryTrees #NodeCounting #CompleteBinaryTree
To view or add a comment, sign in
-
🌟 Day 74 of #100DaysOfCode 🌟 Today, I tackled a challenging problem: finding the maximum sum path using binary tree! 🧩🔍 Feeling accomplished and more confident in my problem-solving skills. Every day is a step closer to mastering algorithms and data structures. 💪 #CodingJourney #BinarySearch #ProblemSolving #KeepLearning
To view or add a comment, sign in
-
🧩 Day 34 of 75 Days Challenge: Successfully Completed the DSA Task! 🧩 Today's challenge was to partition a list, and I’m excited to share that I successfully implemented the solution! This problem was a great way to practice manipulating linked lists and understanding partitioning logic. Each day of this journey strengthens my problem-solving skills and deepens my understanding of data structures and algorithms. Excited for the challenges ahead! #75DaysOfCode #DSAChallenge #CodingJourney #LinkedList #PartitionList #LearningEveryday #ProblemSolving
To view or add a comment, sign in
-
"Day 66 of #100DaysOf100CodingChallenge 🚀 Today's challenge: Finding the largest positive integer that exists with its negative counterpart efficiently using data structures. 💻 Implementing with a logarithmic time complexity algorithm. Let's dive deep into the world of algorithms and data structures! 💡 #CodingChallenge #DataStructures #Algorithm #Efficiency #TechJourney #ProgrammingLife #LinkedInLearning"
To view or add a comment, sign in
-
🎯 Day 9 of #100DaysOfCode - Data Structures & Algorithms Challenge 🎯 Today’s challenge was "54. Spiral Matrix" on LeetCode! This problem was a fun and engaging way to practice navigating through 2D arrays in a non-linear fashion by traversing them in a spiral order. 🌪️ 🧠 Problem Overview: The task was to return all elements of an m x n matrix in spiral order—starting from the top-left corner, moving across the matrix in a clockwise direction, layer by layer. 🚀 My Approach: To solve this, I used a boundary tracking method: Set Up Boundaries: I defined four boundaries: startRow and startCol to track the current starting row and column. endRow and endCol to track the current ending row and column. Traverse in Layers: First, I traversed from left to right across the top row, then moved down the last column, next moved right to left across the bottom row, and finally moved up the first column. After completing one layer of traversal, I shrunk the boundaries inward and repeated the process until all elements were visited. Count Total Elements: I kept track of the number of elements visited to ensure I didn’t go beyond the matrix bounds. This approach allows us to traverse the entire matrix efficiently in O(m * n) time, where m is the number of rows and n is the number of columns. Key Takeaways: Boundary tracking is a powerful technique when working with 2D arrays. It helps in solving problems where we need to traverse or manipulate data in a specific order. This problem was a great way to practice array traversal in unconventional ways, and I enjoyed visualizing the spiral pattern as I worked through it. Another exciting problem checked off in my #100DaysOfCode journey! 💡 #LeetCode #SpiralMatrix #ArrayTraversal #DSA #ProblemSolving #Algorithms #TechJourney #CodingChallenge
To view or add a comment, sign in
-
📚 Currently learning data structures like binary trees and hashing algorithms! 💻 Practicing code daily to master these concepts. Every line of code written is progress towards expertise. 🚀 #datastructuresandalgorithms #codingpractice #neverstoplearning
To view or add a comment, sign in
-
🌟 Just completed Day 74 of the #100DaysOfDSAChallenge! Revised core Data Structures and Algorithms concepts and conquered the Search a 2D Matrix problem on LeetCode. Continuous learning and improvement are key! Stay tuned for more updates! 💪 🕒 Time complexity: O(Log(M∗N)) 🔍 Space complexity: O(1) #DataStructures #Algorithms #LeetCode #ContinuousLearning #ProgrammingJourney
To view or add a comment, sign in