𝐖𝐞𝐞𝐤 2 | 𝐃𝐚𝐲 6/7 — 𝐃𝐒𝐀 𝐂𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞 Today, I practiced generating 𝐮𝐧𝐢𝐪𝐮𝐞 𝐩𝐞𝐫𝐦𝐮𝐭𝐚𝐭𝐢𝐨𝐧𝐬 𝐨𝐟 𝐚𝐧 𝐚𝐫𝐫𝐚𝐲 containing duplicate elements using Java Backtracking. 𝐊𝐞𝐲 𝐇𝐢𝐠𝐡𝐥𝐢𝐠𝐡𝐭𝐬: • Implemented backtracking with recursion to explore all arrangements • Sorted the array to handle duplicate elements efficiently • Used a boolean tracking array to manage element usage • Applied duplicate-skipping logic to ensure only unique permutations • Strengthened understanding of recursion trees and state tracking This challenge improved my ability to handle duplicate constraints in combinatorial problems, an important concept for technical interviews and real-world algorithm design. #Day6Of7DaysOfCode #DSA #Java #Backtracking #Recursion #ProblemSolving #CodingChallenge #InterviewPrep #Algorithms
Java Backtracking for Unique Permutations with Duplicates
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 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 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 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 25 – Find Minimum in Rotated Sorted Array Solved this rotated array problem using a modified Binary Search approach in O(log n). Key Learning: By comparing mid with right, I identified which half contains the minimum and reduced the search space efficiently. #DSA #BinarySearch #RotatedArray #Java #InterviewPrep
To view or add a comment, sign in
-
-
Day 35/100 - LEETCODE Challenge ✅ Problem : Permutations Implemented a Java program to generate all permutations of an integer array and store them in a List<List<Integer>> using a backtracking approach. This solution avoids built-in permutation utilities and efficiently explores all possible arrangements by recursively building combinations and undoing choices (backtracking). Strengthened understanding of recursion, data structures (List, ArrayList), and algorithmic problem solving commonly used in coding interview platforms like LeetCode. #100DaysOfCode #java #Coding #SoftwareDeveloper
To view or add a comment, sign in
-
-
• String & String Constant Pool • Immutability & Memory Management • String Comparison Techniques • Concatenation Methods & Performance Tests • substring(), split(), indexOf() • String vs StringBuffer vs StringBuilder • Immutable Class Design • toString() Method • StringTokenizer (Legacy vs Modern Approach) Understanding how Strings work internally is crucial for writing efficient, optimized, and interview-ready Java code. Strong fundamentals. Clean code. Better performance. #Java #CoreJava #JavaDeveloper #DSA #StringConcepts #Coding #LearningJourney #CodesInTransit #InterviewPreparation #MondayMotivation #RevisitingTheTopics
To view or add a comment, sign in
-
Sometimes the value isn’t in building models — it’s in making them usable. I built an Image Classification library in Java using the Deep Java Library and a pretrained ResNet-50 model. The focus was not on training a model, but on designing a clean and reusable integration: • Simple service API for image classification • Proper exception handling and abstraction • Configurable via environment variables • Easy to plug into backend systems Working on this helped me understand that integrating ML into applications is less about algorithms and more about designing reliable and maintainable systems around them. https://lnkd.in/gQ6dQEtQ #Java #DJL #MachineLearning #BackendDevelopment #SoftwareEngineering #AIinJava
To view or add a comment, sign in
-
Entry-level Algorithm Challenge: Array Manipulation in Java. Today I tackled a foundational exercise: reading a list of numbers and filtering out only the negative values. It was a great opportunity to reinforce some core Java concepts: 1. Flow control with do-while loop: Ensuring valid input within a specific range. 2. Simplified iteration with for-each loop: Improving code readability. 3. Handling flags (boolean signals): Providing clear, user-friendly feedback. Check out the logic below! 👇 #Java #Algorithms #SoftwareDevelopment #Coding
To view or add a comment, sign in
-
-
Built a Java program to classify user input 💻 Used Scanner for taking input from user. Extracted character using charAt(0). Checked if input is alphabet, digit, or special character. Handled both uppercase and lowercase cases. Applied if-else logic effectively. Improved understanding of Java fundamentals. Practiced clean and structured coding. Strengthening logic building step by step 🚀 Consistency leads to better problem-solving skills 🔥 #Java #JavaProgramming #CodingJourney #LearnToCode #StudentDeveloper #ProgrammingBasics #LogicBuilding #TechSkills #VSCode #100DaysOfCode
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