𝐖𝐞𝐞𝐤 2 | 𝐃𝐚𝐲 5/7 — 𝐃𝐒𝐀 𝐂𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞 Today, I practiced generating all possible 𝐩𝐞𝐫𝐦𝐮𝐭𝐚𝐭𝐢𝐨𝐧𝐬 of an array of distinct integers using Java. 𝐊𝐞𝐲 𝐇𝐢𝐠𝐡𝐥𝐢𝐠𝐡𝐭𝐬: • Implemented backtracking to explore all possible sequences • Used a temporary list to build permutations step by step • Applied recursive calls and backtracking by adding/removing elements • Reinforced concepts of recursion, lists, and algorithmic problem solving This challenge helped me strengthen my problem-solving skills and understanding of recursive algorithms, which are widely used in DSA problems and real-world applications. #Day5Of7DaysOfCode #DSA #Java #Backtracking #ProblemSolving #Algorithm #CodingChallenge #Recursion
Java Backtracking Permutations Challenge
More Relevant Posts
-
Day 32 of #100DaysOfLeetCode 💻✅ Solved #144. Binary Tree Preorder Traversal on LeetCode using Java. Approach: • Used recursion to perform preorder traversal • Followed Root → Left → Right order strictly • Added node value before traversing subtrees • Traversed left subtree first, then right subtree • Stored values in a list during traversal Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) ✓ Memory: 42.83 MB (Beats 96.77% submissions) Key Learning: ✓ Strengthened understanding of preorder traversal pattern ✓ Clearly differentiated preorder from inorder traversal ✓ Improved recursive tree traversal implementation skills Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinaryTree #Recursion #TreeTraversal #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 31 of #100DaysOfLeetCode 💻✅ Solved #94. Binary Tree Inorder Traversal on LeetCode using Java. Approach: • Used recursion to perform inorder traversal • Followed Left → Root → Right order strictly • Traversed left subtree first before processing current node • Stored node values in a list during traversal • Returned the final list after complete traversal Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) ✓ Memory: 42.76 MB (Beats 98.30% submissions) Key Learning: ✓ Strengthened understanding of tree traversal patterns ✓ Improved clarity on recursion stack behavior ✓ Reinforced difference between preorder, inorder, and postorder traversal Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinaryTree #Recursion #TreeTraversal #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 38 of #100DaysOfLeetCode 💻✅ Solved #222. Count Complete Tree Nodes problem in Java. Approach: • Used recursion to traverse the binary tree • Counted the current node and recursively counted nodes in left and right subtrees • Added the counts to get the total number of nodes • Returned 0 when the node is null to stop recursion Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 44 MB Key Learning: ✓ Practiced recursion with binary trees ✓ Understood how tree traversal helps count nodes in a tree ✓ Improved recursive thinking while solving tree problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 30 of #100DaysOfLeetCode 💻✅ Solved #108. Convert Sorted Array to Binary Search Tree on LeetCode using Java. Approach: • Used Divide and Conquer strategy • Selected the middle element as the root to maintain balance • Recursively built the left subtree using left half of array • Recursively built the right subtree using right half of array • Ensured the tree remains height-balanced at every step Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) ✓ Memory: 45.18 MB (Beats 44.10% submissions) Key Learning: ✓ Understood how sorted arrays can directly map to balanced BST ✓ Strengthened recursion fundamentals in tree construction ✓ Improved understanding of height-balanced binary trees Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinarySearchTree #Recursion #DivideAndConquer #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 33 of #100DaysOfLeetCode 💻✅ Solved #145. Binary Tree Postorder Traversal on LeetCode using Java. Approach: • Used recursion to perform postorder traversal • Followed Left → Right → Root order strictly • Traversed left subtree first • Then traversed right subtree • Added node value after visiting both subtrees Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) ✓ Memory: 43.12 MB (Beats 71.37% submissions) Key Learning: ✓ Clearly understood difference between preorder, inorder, and postorder ✓ Strengthened recursive tree traversal concepts ✓ Improved confidence in handling binary tree problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinaryTree #Recursion #TreeTraversal #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 27 of #100DaysOfLeetCode 💻✅ Solved #83. Remove Duplicates from Sorted List on LeetCode using Java. Approach: • Utilized the fact that the linked list is already sorted • Traversed the list using a single pointer • Compared current node value with next node value • If duplicate found, skipped the next node by updating links • Continued traversal until reaching the end of the list Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 45.30 MB (Beats 85.70% submissions) Key Learning: ✓ Understood how sorting simplifies duplicate removal logic ✓ Strengthened pointer manipulation skills in linked lists ✓ Learned efficient in-place modification without extra space Learning one problem every single day 🚀 #Java #LeetCode #DSA #LinkedList #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 34 of #100DaysOfLeetCode 💻✅ Solved #110. Balanced Binary Tree on LeetCode using Java. Approach: • Used a bottom-up recursive approach to calculate height • Returned -1 immediately if any subtree is unbalanced • Compared left and right subtree heights at each node • Checked if the height difference is greater than 1 • Stopped early to optimize unnecessary computations Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) ✓ Memory: 45.33 MB (Beats 95.41% submissions) Key Learning: ✓ Understood how to combine height calculation with balance checking ✓ Learned early termination technique in recursion ✓ Improved problem-solving for tree-based recursive problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinaryTree #Recursion #TreeProblems #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 36 of #100DaysOfLeetCode 💻✅ Solved #111. Minimum Depth of Binary Tree on LeetCode using Java. Approach: • Used recursive approach to calculate minimum depth • Returned 0 when root is null (base case) • If one subtree is null, avoided taking minimum of 0 (handled edge case carefully) • Returned 1 + minimum depth of valid subtree • Ensured correct handling of skewed trees Performance: ✓ Runtime: 6 ms ✓ Memory: 82.20 MB Key Learning: ✓ Understood difference between minimum depth and maximum depth logic ✓ Learned importance of handling null subtree cases correctly ✓ Improved confidence in solving binary tree recursion problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinaryTree #Recursion #TreeProblems #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 46 of #100DaysOfLeetCode 💻✅ Solved #374. Guess Number Higher or Lower problem in Java. Approach: • Used Binary Search to efficiently guess the number. • Calculated mid using low + (high - low) / 2 to avoid overflow. • Used the guess(mid) API to check if the number is higher, lower, or correct. • Updated the search range accordingly until the number was found. Performance: ✓ Runtime: 0 ms (Beats 100% submissions) 🚀 ✓ Memory: 41.68 MB (Beats 97.84% submissions) Key Learning: ✓ Practiced implementing binary search on a real problem ✓ Learned how to safely calculate mid to prevent integer overflow ✓ Strengthened problem-solving skills with search algorithms Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinarySearch #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
👌 🚀 Day 17 / 180 – DSA with Java 🚀 📘 Topic Covered: Arrays & Reversal Algorithm 🧩 Problem Solved: Rotate Array Problem: Rotate an array to the right by k steps, modifying it in-place without using extra space. Approach: Used the reversal algorithm: 1️⃣ Reversed the entire array 2️⃣ Reversed the first k elements 3️⃣ Reversed the remaining elements This efficiently achieved rotation in O(n) time with O(1) extra space. Key Learning: ✔️ Using reversal technique for array manipulation ✔️ Breaking complex operations into smaller steps ✔️ Writing optimized in-place solutions If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Arrays #ProblemSolving #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