🚀 Day 26/100 – LeetCode Challenge ✅ Problem Solved: Valid Perfect Square Today’s problem was about checking whether a number is a perfect square without using any built-in functions like sqrt. I solved it using Binary Search, which helped efficiently determine whether there exists an integer whose square equals the given number. 💡 Key Learning: Binary Search can be applied beyond arrays Handling large numbers requires careful use of data types Avoiding overflow is important in mathematical problems ⚡ Complexity: Time: O(log n) Space: O(1) Learning to apply fundamentals in different ways every day 🚀 #Day26 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #BinarySearch #ProblemSolving
Valid Perfect Square Solution with Binary Search
More Relevant Posts
-
🚀 Day 26/100 — LeetCode Challenge Today's problem: Search in Rotated Sorted Array II 🧠 Concept: Binary Search with Edge Cases 💡 Key Idea: Duplicates can make it difficult to identify the sorted half. In such cases, shrink the search space from both ends. ⚡ Time Complexity: O(log n) average, O(n) worst case 📂 Solutions Repository https://lnkd.in/gkFh2mPZ A great example of how edge cases can complicate an otherwise straightforward approach. #100DaysOfLeetCode #DSA #LeetCode #CodingChallenge #SoftwareEngineering
To view or add a comment, sign in
-
Day 29 – LeetCode Journey 🚀 Solved Two Sum II – Input Array Is Sorted using the Two Pointer technique, leveraging the sorted nature of the array for an optimal solution. 🔹 Time Complexity: O(n) 🔹 Runtime: 2 ms (Beats 96.37%) 🔹 Memory Usage: 48.58 MB This problem is a great reminder that recognizing patterns (like sorted arrays) can significantly reduce complexity and improve efficiency. Small optimizations, big impact 📈 Staying consistent and sharpening problem-solving skills every day. #LeetCode #DSA #ProblemSolving #CodingJourney #SoftwareEngineering #Consistency #Learning
To view or add a comment, sign in
-
-
🚀 Day 29/100 — LeetCode Challenge Today's problem: Find First and Last Position of Element in Sorted Array 🧠 Concept: Binary Search (Boundary Finding) 💡 Key Idea: Use binary search twice to find the first and last occurrence of a target element in a sorted array. ⚡ Time Complexity: O(log n) 📂 Solutions Repository https://lnkd.in/gkFh2mPZ Understanding how to modify binary search to handle duplicates and find boundaries. #100DaysOfLeetCode #DSA #LeetCode #CodingChallenge #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Day 29/100 – LeetCode Challenge ✅ Problem Solved: Find Peak Element Today’s problem was a great application of Binary Search beyond traditional searching. The goal was to find a peak element — an element greater than its neighbors. Instead of checking every element, I used a binary search approach to efficiently narrow down the search space and find a peak in O(log n) time. 💡 Key Learning: Binary Search can be applied to decision-based problems Observing patterns (increasing/decreasing) helps reduce complexity Not all problems require checking every element ⚡ Complexity: Time: O(log n) Space: O(1) Learning to think smarter, not harder 🚀 #Day29 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #BinarySearch #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 18/100 – LeetCode Challenge Today’s problem: Linked List Cycle Detection Finally got hands-on with the famous Floyd’s Cycle Detection Algorithm (Tortoise & Hare) — and it was a great learning experience! 🧠 💡 Key Learnings: - Using two pointers ("slow" & "fast") can optimize both time and space - If a cycle exists, both pointers are bound to meet at some point - No extra space needed → O(1) space complexity 🔥 ⚡ Complexity: - Time: O(n) - Space: O(1) What I really liked about this problem is how a simple idea (different speeds) leads to an efficient and elegant solution. Problems like these remind me why consistency matters in DSA practice. #100DaysOfCode #LeetCode #DSA #CodingJourney #Consistency #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 27/100 – LeetCode Challenge ✅ Problem Solved: Remove Duplicates from Sorted Array Today’s problem was a classic example of using the two-pointer technique. The goal was to remove duplicates from a sorted array in-place while maintaining the order of elements. I used two pointers to track unique elements and overwrite duplicates efficiently without using extra space. 💡 Key Learning: Two-pointer technique is very effective for array problems In-place operations help reduce space complexity Understanding problem constraints leads to optimal solutions ⚡ Complexity: Time: O(n) Space: O(1) Consistency is building confidence step by step 🚀 #Day27 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #TwoPointers #ProblemSolving
To view or add a comment, sign in
-
-
Day 30 – LeetCode Journey 🚀 Solved Trapping Rain Water — a classic Hard problem that tests deep understanding of two-pointer optimization and space efficiency. Instead of brute force or extra space, applied an optimized two-pointer approach to compute trapped water in a single pass. 🔹 Time Complexity: O(n) 🔹 Runtime: 0 ms (Beats 100%) ⚡ 🔹 Memory Usage: Optimized This problem reinforced how powerful pointer techniques can be when combined with the right intuition. 30 days of consistency, learning, and growth — and just getting started 💪 #Day30 #LeetCode #DSA #ProblemSolving #CodingJourney #SoftwareEngineering #Consistency #KeepLearning
To view or add a comment, sign in
-
-
Just crossed 100 problems solved on LeetCode. Not impressive by itself—but what matters is consistency. Most of these came from sticking to fundamentals like arrays, two pointers, and basic problem patterns instead of jumping around randomly. Current focus: • Strengthening problem-solving patterns • Reducing time per problem • Moving from Easy → Medium consistently Still a long way to go. Next target: 200 with stronger Medium coverage. If you're grinding LeetCode too, focus less on quantity and more on pattern recognition—it compounds faster. #LeetCode #DSA #CodingJourney #ProblemSolving #SoftwareEngineering
To view or add a comment, sign in
-
-
Day 2/100 of my LeetCode Journey Today I solved “Kth Largest Element in an Array.” Initially, I made a basic mistake. I approached it like a search problem, trying to find a specific value. But this problem is actually about position—finding the kth largest element in sorted order. That small shift in thinking made a big difference. What I learned: The same problem can be solved in multiple ways. Sorting is the simplest. Heaps are more efficient, and quickselect is even more optimized on average. I focused more on understanding why each approach works rather than just coding one solution. Takeaway: Sometimes the main difficulty is not coding, but understanding what the problem is really asking. Still a lot to improve, but making steady progress. Question: Do you usually stick to one approach or try to understand multiple ways to solve the same problem? #Day2 #LeetCode #DSA #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
Day 40 | LeetCode Learning Journal 🚀 Today I solved Validate Binary Search Tree (BST) using a range-based recursive approach. This problem helped me deeply understand how BST properties apply to the entire tree, not just immediate children! 🔑 Key Points: • Checked whether a binary tree is a valid BST. • Maintained a valid range (min, max) for each node. • Ensured every node follows BST rules globally. • Used recursion to traverse and validate nodes. 🌱 What I Learned: • Importance of passing constraints (min/max) in recursion. • Difference between local vs global validation in trees. • Strengthened understanding of Binary Search Tree properties. • Improved recursive thinking for tree problems. #LeetCode #100DaysOfCode #DSA #CodingJourney #Day40 🚀
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