Day 26 | LeetCode Learning Journal 🚀 Today I solved Permutations. This problem helped me understand the concept of recursion and backtracking more deeply! 🔑 Key Points: • Used backtracking to generate all possible arrangements. • Swapped elements to fix one position at a time. • Recursively solved for the remaining array. • Backtracked by swapping elements back to their original positions. • Explored all possible permutation paths systematically. 🌱 What I Learned: • Strong understanding of recursion tree and backtracking flow. • Importance of undoing changes (backtracking step). • How to generate all permutations efficiently. • Improved problem-solving approach for recursive problems. #LeetCode #100DaysOfCode #DSA #CodingJourney #Day26 🚀
Permutations Solved with Recursion and Backtracking
More Relevant Posts
-
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
-
-
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 51 of my LeetCode Journey Solved: Roman to Integer At first glance, this problem looks simple — just map symbols to numbers. But the real catch is handling subtractive cases like IV (4), IX (9), etc. 💡 Key Learning: Instead of blindly adding values, you need to compare current and next characters: If current < next → subtract Else → add This small twist is what separates a correct solution from a wrong one. 📊 Result: ✅ Accepted ⏱️ Runtime: 6 ms 📌 Takeaway: Even “easy” problems test your attention to detail. Don’t underestimate them. Consistency > Motivation. See you on Day 52. #LeetCode #DSA #CodingJourney #ProblemSolving #Consistency
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 38 | LeetCode Learning Journal 🚀 Today I solved Valid Palindrome using the two-pointer approach. This problem helped me understand how to efficiently process strings while ignoring unnecessary characters! 🔑 Key Points: • Given a string, check if it is a palindrome. • Ignored non-alphanumeric characters (spaces, symbols). • Compared characters in a case-insensitive manner. • Used two pointers (left & right) for efficient checking. 🌱 What I Learned: • How to use the two-pointer technique for string problems. • Importance of handling edge cases (special characters). • Optimizing space complexity (no extra string needed). • Writing clean and efficient logic for real-world scenarios. #LeetCode #100DaysOfCode #DSA #CodingJourney #Day38 🚀
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 49/100 — Simplicity Wins Again 💯. Today’s problem: LeetCode 2529 — Maximum Count of Positive and Negative Integers. 📌 Problem Summary: Given a sorted array, 👉 Count positive numbers 👉 Count negative numbers 👉 Return the maximum of both ⚠️ Ignore zeros 💡 Brute Force: a)Traversed the array once. b)Counted positives and negatives separately. c)Returned max(positive, negative). 🧠 Key Learning: 👉 Simple counting problems can be solved in one pass. 👉 Edge cases like 0 matter a lot. 👉 Clean and readable code > complex logic. ⚡ Insight: Not every problem needs optimization — clarity and correctness come first 👀 🎯 Showing up daily > being perfect 🚀 #LeetCode #DSA #CodingJourney #KeepLearning
To view or add a comment, sign in
-
-
🚀 Day 28/100 – LeetCode Challenge ✅ Problem Solved: Third Maximum Number Today’s problem was about finding the third distinct maximum number in an array. If it doesn’t exist, we return the maximum number instead. I solved this using an optimized approach by tracking the top three distinct values in a single pass without using extra space. 💡 Key Learning: Handling distinct elements is important in many problems Maintaining multiple variables can replace sorting One-pass solutions improve efficiency significantly ⚡ Complexity: Time: O(n) Space: O(1) Consistency is turning effort into progress every day 🚀 #Day28 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
Solved an interesting problem on Leetcode today!! It looks simple at first glance, but asked to solve with O(1) space. The problem asks the array to rotate by k steps initially. I thought it was by k elements, but later I found out it doesn't work in this way. Approach: 1. Reverse the array 2. Reverse from start to start+k 3. Reverse form start+k to end. Key takeaway: This problem really helped me understand how to rotate the array in an efficient way. #Leetcode #DSA #ProblemSolving #CodingJourney #Arrays
To view or add a comment, sign in
-
LeetCode Progress 19/50 — Third Maximum Number I worked on a problem focused on array traversal and finding distinct elements 🧩 💡 The challenge was to find the third distinct maximum number in an array, and if it does not exist, return the maximum number. 🧠 Approach: Tracked the top three distinct maximum values while iterating through the array, ensuring duplicates were ignored. This avoided the need for extra sorting and kept the solution efficient. ⏱ Time Complexity: O(n) 💡 What I learned: This problem reinforced how maintaining a few variables smartly can replace the need for sorting and lead to optimized solutions. 📈 Improving efficiency in handling arrays and focusing on writing optimized logic. #LeetCode #DSA #ProblemSolving #Cpp #CodingJourney #Consistency 🚀
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