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
Java Permutations Solution for LeetCode Challenge
More Relevant Posts
-
100 Days of Coding Challenge – Day 29 📌 Problem: Isomorphic Strings 💻 Language: Java 🧠 Concept Used: HashMap + Bidirectional Mapping 🔍 Platform: LeetCode Two strings are isomorphic if characters in one string can be replaced to get the other string with a one-to-one mapping, while preserving order. Example: s = "egg", t = "add" → ✅ true Approach: ✔ Traverse both strings simultaneously ✔ Use two HashMaps: • One for mapping s → t • One for mapping t → s ✔ Ensure consistency in both directions ✔ If any mismatch occurs → return false Time Complexity: O(n) Space Complexity: O(n) 🔗 Problem Link: https://lnkd.in/gHJ3Vn2a 🔗 Code: https://lnkd.in/gWrRUiN4 #100DaysOfCode #Day29 #Java #DSA #LeetCode #HashMap #Strings #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Mastering Java Through LeetCode 🧠 Day 2 I’m continuing my journey of solving problems from the LeetCode 75 list to strengthen my Data Structures and Algorithms (DSA) skills using Java. Consistency in problem-solving is helping me improve logical thinking and prepare for real-world software engineering interviews. 📌 LeetCode problem solved today: Q. 1071 – Greatest Common Divisor of Strings 📝 Problem Summary: For two strings s and t, we say t divides s if s is formed by repeating t multiple times. 👉 The goal is to find the largest string x that divides both str1 and str2. 💡 Key Insight: ✔️ If (str1 + str2).equals(str2 + str1) → a common pattern exists ✔️ Then the answer is based on GCD of lengths 💻 Key Java concepts practiced: ✔️ String concatenation & comparison ✔️ Pattern recognition in strings ✔️ Recursion (GCD using Euclidean algorithm) ✔️ Substring operations ✔️ Combining math with programming logic Takeaway: This problem shows how combining Mathematical concepts (GCD) with String manipulation can lead to efficient solutions. #Java #DSA #LeetCode #ProblemSolving #CodingJourney #JavaDeveloper #TechSkills #LearningInPublic #CodingPractice #SoftwareEngineering #Developers #CodingLife
To view or add a comment, sign in
-
-
Problem Solved Today 💡 Today I solved a basic problem on Arrays, and it taught me something important. 📌 Problem: Find the largest element in an array 📌 Approach: Used a simple loop to compare elements 📌 Language: C / Java 👉 What I learned: Instead of jumping to complex solutions, sometimes simple logic works best. Coding is not about writing big code, it’s about clear thinking. Small steps every day = big improvement over time 🚀 #CodingJourney #ProblemSolving #Java #CProgramming #DataStructures #LearnToCode #FutureEngineer
To view or add a comment, sign in
-
Day 21 of #100DaysOfCode Today, I worked on the classic string problem: implementing the strStr() function in Java. The goal: Find the first occurrence of a substring (needle) inside another string (haystack). Approach I used: - Applied a sliding window technique - Compared substrings using "substring(i, j)" - Returned the starting index when a match is found Key learning: Understanding how index-based string operations work and how "substring()" helps in breaking down problems step-by-step. Also realized the importance of optimizing solutions to avoid unnecessary string creation. Consistency is slowly turning concepts into confidence! Looking forward to improving this further with more optimized approaches #Java #Coding #DSA #LeetCode #ProblemSolving #LearningJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 48/100:-Odd String Difference Not every problem is about writing code — some are about seeing patterns clearly. 🧠 Today, I worked on the "Odd String Difference" problem using Java. 🔍 Instead of comparing strings directly, I learned to: • Convert each string into a difference array • Identify patterns between characters • Detect the one string that breaks the pattern 💡 Key takeaway: Breaking a problem into smaller transformations makes complex logic much easier to handle. ⚡ Result: Efficient solution with strong runtime and memory performance ✅ Step by step, improving not just coding — but the way I think. #Day48 #100DaysOfCode #DSA #Java #ProblemSolving #LeetCode #Consistency #LearningInPublic
To view or add a comment, sign in
-
-
100 Days of Coding Challenge – Day 30 📌 Problem: Find the Index of the First Occurrence in a String 💻 Language: Java 🧠 Concept Used: String Matching (Brute Force) 🔍 Platform: LeetCode Today’s challenge was to find the first occurrence of a substring (needle) in a given string (haystack). If not found, return -1. Example: Input: "sadbutsad", "sad" Output: 0 Approach: ✔ Traverse the string from index 0 to n - m ✔ Extract substring of length m at each position ✔ Compare it with the target string ✔ Return index immediately when match is found ✔ If no match → return -1 Time Complexity: O(n × m) Space Complexity: O(1) 🔗 Problem Link: https://lnkd.in/g2ktYFFS 🔗 Code: https://lnkd.in/gynFixSQ #100DaysOfCode #Day30 #Java #DSA #LeetCode #Strings #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Day 8 — Array problems Searching & basic operations Method practice (modular coding) Big shift: Stopped writing everything in one block. Started breaking problems into functions. Less chaos. More structure. Day 9 tomorrow. #LearnInPublic #Java #BuildInPublic
To view or add a comment, sign in
-
Day 17 of #100DaysOfCode Today I worked on Binary Search (LeetCode 704) — a classic and powerful algorithm every developer should master. What I learned: How binary search reduces time complexity to O(log n) Importance of working on sorted arrays How to efficiently divide the search space using start, end, and mid Writing clean and optimal Java code for real interview scenarios Key takeaway: Instead of checking every element (O(n)), binary search helps us eliminate half of the data in each step — making it super fast and efficient. Problems like these remind me that understanding the logic is more important than just coding the solution. Consistency is the goal, improvement is the result. #Day17 #100DaysOfCode #Java #DataStructures #Algorithms #BinarySearch #CodingJourney #LeetCode
To view or add a comment, sign in
-
-
🚀 Day 538 of #750DaysOfCode 🚀 Today I solved Flip Square Submatrix Vertically (LeetCode 3643) using Java. 🔹 Problem Summary: Given a matrix and a square submatrix defined by top-left corner (x, y) and size k, we need to flip that square vertically. Flipping vertically means reversing the order of rows inside the selected k × k submatrix while keeping the rest of the matrix unchanged. 🔹 Approach Used: I used a two-pointer approach to swap rows inside the square: • One pointer at the top row • One pointer at the bottom row • Swap elements column by column inside the square • Move pointers towards the center This way, the submatrix gets flipped vertically in-place without extra space. 🔹 Key Concepts Learned: ✅ Matrix traversal ✅ Submatrix manipulation ✅ Two-pointer technique ✅ In-place swapping ✅ Clean implementation in Java Small problems like this help in mastering matrix operations, which are very common in coding interviews. #750DaysOfCode #Day538 #LeetCode #Java #DSA #Algorithms #CodingChallenge #Matrix #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
Every problem teaches something new — today it was LeetCode 50: Pow(x, n) At first, it looked simple: just calculate power. But the real challenge was optimizing it and handling edge cases like negative powers and Integer.MIN_VALUE overflow. Learned how Binary Exponentiation can turn an O(n) solution into O(log n) — that’s the beauty of algorithms! Moments like these remind me that problem-solving is not just about writing code, but thinking deeper. #LeetCodeJourney #DSA #KeepLearning #Java #ProblemSolving
To view or add a comment, sign in
-
Explore related topics
- LeetCode Array Problem Solving Techniques
- Approaches to Array Problem Solving for Coding Interviews
- Leetcode Problem Solving Strategies
- Why Use Coding Platforms Like LeetCode for Job Prep
- Common Algorithms for Coding Interviews
- Problem Solving Techniques for Developers
- How to Use Arrays in Software Development
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