Sanjeev Kumar’s Post

🚀 Day 6 of My LeetCode Journey — Search Like a Pro Today was all about mastering the fundamentals of searching: 🔹 Linear Search 🔹 Binary Search (LeetCode 704) 💡 Problem 1: Linear Search The most straightforward approach: 👉 Traverse each element 👉 Compare until you find the target Simple, but important to understand its limitation: ⏱️ Time Complexity: O(n) 💡 Problem 2: Binary Search This is where things get interesting 🔥 👉 Works only on sorted arrays 👉 Divide the search space in half every step Result: ⏱️ Time Complexity: O(log n) 🚀 This problem really helped me understand how powerful optimization can be when the data is structured correctly. 🔥 Key Takeaways: Always check if the array is sorted → you might use Binary Search Optimization often comes from reducing the search space Fundamentals like searching form the base of everything in DSA Grateful for the learning journey with Namaste DSA and Akshay Saini 🚀 Day 7 coming up 💪 #LeetCode #DataStructures #Algorithms #CodingJourney #100DaysOfCode #SoftwareEngineering #Programming #InterviewPrep #JavaScript #CodingLife #TechGrowth #ProblemSolving #Developers #LearnToCode #BinarySearch #LinearSearch #NamasteDSA

To view or add a comment, sign in

Explore content categories