📅 Day 90 of #100DaysOfCode Problem: Find Minimum in Rotated Sorted Array (LeetCode 153) Approach (Binary Search): 1️⃣ Used two pointers: left and right. 2️⃣ Found mid in each iteration. 3️⃣ If nums[mid] > nums[right], it means the minimum lies in the right half → move left = mid + 1. 4️⃣ Otherwise, the minimum lies in the left half (including mid) → move right = mid. 5️⃣ Continued until left == right, which gives the minimum element. #100DaysOfCode #LeetCode #DSA #BinarySearch #Arrays #ProblemSolving #Cplusplus #CodingChallenge #Programming #DeveloperLife #DailyDSA #KeepLearning #TechCommunity #GrowthMindset #Motivation
Finding Min in Rotated Sorted Array with Binary Search
More Relevant Posts
-
Day 91 LeetCode 153: Find Minimum in Rotated Sorted Array Approach (Binary Search): 1️⃣ Used two pointers: left and right. 2️⃣ Found mid in each iteration. 3️⃣ If nums[mid] > nums[right], the minimum lies in the right half → left = mid + 1. 4️⃣ Otherwise, the minimum lies in the left half (including mid) → right = mid. 5️⃣ Continued until left == right, which gives the minimum element. Time Complexity: O(log n) Space Complexity: O(1) #100DaysOfCode #LeetCode #DSA #BinarySearch #Arrays #ProblemSolving #Cplusplus #CodingChallenge #Programming #DeveloperLife #DailyDSA #KeepLearning #TechCommunity #GrowthMindset #Motivation
To view or add a comment, sign in
-
-
📅 Day 96 of #100DaysOfCode Problem: Rotate List (LeetCode 61) Approach (Linked List Manipulation): 1️⃣ Calculated the length of the linked list. 2️⃣ Connected the tail to the head to form a circular list. 3️⃣ Reduced rotations using k % length. 4️⃣ Found the new tail at position length - k. 5️⃣ Broke the circular link to get the new rotated list. #100DaysOfCode #LeetCode #DSA #LinkedList #Pointers #ProblemSolving #Cplusplus #CodingChallenge #Programming #DeveloperLife #DailyDSA #KeepLearning #TechCommunity #GrowthMindset #Motivation
To view or add a comment, sign in
-
-
📅 Day 98 of #100DaysOfCode Problem: Delete and Earn (LeetCode 740) Approach (Dynamic Programming — House Robber Pattern): 1️⃣ Converted the array into a points array where each index stores total value earned from that number. 2️⃣ Choosing a number deletes its adjacent values (num - 1 and num + 1). 3️⃣ Recognized the pattern similar to the House Robber problem. 4️⃣ At each step, decided whether to take or skip the current value. 5️⃣ Used dynamic programming to maximize total earned points. Many DP problems become easier once you recognize familiar patterns 🧠 #100DaysOfCode #LeetCode #DSA #DynamicProgramming #DP #Arrays #ProblemSolving #Cplusplus #CodingChallenge #Programming #DeveloperLife #DailyDSA #KeepLearning #TechCommunity #GrowthMindset #Motivation
To view or add a comment, sign in
-
-
🔥 Selection Sort – Code Implementation 🔥 Today I implemented Selection Sort 🧠💻 ✔️ Simple comparison-based sorting algorithm ✔️ Repeatedly selects the minimum element ✔️ Swaps it with the current index ✔️ Time Complexity: O(n²) Clean logic. Easy to understand. Great for learning sorting fundamentals. 🚀 #SelectionSort #DSA #CodingJourney #Programming #LearnToCode
To view or add a comment, sign in
-
📅 Day 93 of #100DaysOfCode Problem: Palindrome Partitioning (LeetCode 131) Approach (Backtracking + Recursion): 1️⃣ Used backtracking to explore all possible substring partitions. 2️⃣ At each step, checked if the current substring is a palindrome. 3️⃣ If it is a palindrome → added it to the current path. 4️⃣ Recursively continued for the remaining substring. 5️⃣ Once we reached the end of the string → stored the valid partition. 6️⃣ Backtracked to explore other possible partitions. #100DaysOfCode #LeetCode #DSA #Backtracking #Recursion #Strings #ProblemSolving #Cplusplus #CodingChallenge #Programming #DeveloperLife #DailyDSA #KeepLearning #TechCommunity #GrowthMindset #Motivation
To view or add a comment, sign in
-
-
🚀 100 Days of LeetCode — Day 59 🧩 Problem Integer to Roman 💡 Core Idea To convert an integer into a Roman numeral, I used a place value mapping approach. The number is divided into four parts: Thousands Hundreds Tens Ones For each place value, I stored precomputed Roman numeral representations in arrays. Then I used direct indexing to select the correct Roman numeral and concatenate them. This approach avoids loops and complex conditions, making the solution simple and efficient. 📚 Key Learnings 1. Mapping values using arrays 2. Direct index lookup optimization 3. Breaking numbers using place value decomposition ⏱ Complexity Time Complexity: O(1) Space Complexity: O(1) #100DaysOfLeetCode #LeetCode #DSA #Programming #Cplusplus #CodingChallenge #ProblemSolving #TechJourney
To view or add a comment, sign in
-
-
Exceptions are a plague on programming. ... but that's exactly why you need to understand the basics of handling them! This article is aimed at beginners and focuses on the structure of try/catch/finally blocks in CSharp. See how each part of these code blocks is responsible for handling exceptions and clean-up in your code! Check out the article: https://lnkd.in/gVTiSvGr #CSharp #DotNetCore #Coding #Programming
To view or add a comment, sign in
-
-
Seeing the community adopt Dragon has been incredible. To make your development process even smoother, I just put together the official Dragon v1.0.3 Cheatsheet. I wanted to give you a single reference point for variables, loops, OOP syntax, and standard modules so you can spend less time reading docs and more time building. #Dragon #Programming #CheatSheet #learn
To view or add a comment, sign in
-
-
"If the code works, it must be correct.” Reality check: Code can run perfectly and still be wrong. In C/C++ especially: Returning pointers to local variables may seem fine char + char doesn’t behave the way beginners expect Undefined behavior can stay hidden for years The dangerous bugs aren’t the ones that crash. They’re the ones that quietly pass. Big lesson for me: Understanding why something works matters more than just making it work. What’s one coding myth you believed early in your journey? #Programming #Cplusplus #SoftwareEngineering #LearningInPublic #Coding
To view or add a comment, sign in
-
📅 Day 95 of #100DaysOfCode Problem: Path Sum (LeetCode 112) Approach (Recursion / DFS): 1️⃣ Traversed the binary tree using Depth First Search (DFS). 2️⃣ Subtracted the current node value from the target sum. 3️⃣ When reaching a leaf node, checked if remaining sum equals node value. 4️⃣ Recursively checked both left and right subtrees. 5️⃣ Returned true if any root-to-leaf path matched the target sum. #100DaysOfCode #LeetCode #DSA #BinaryTree #DFS #Recursion #ProblemSolving #Cplusplus #CodingChallenge #Programming #DeveloperLife #DailyDSA #KeepLearning #TechCommunity #GrowthMindset #Motivation
To view or add a comment, sign in
-
Explore related topics
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