🚀 Day 137/160 – Maximize Partitions in a String Learned how to split a string into the maximum number of substrings such that no two parts share a common character. ✨ Key Concepts: Greedy Algorithm, Character Tracking, String Partitioning 💻 Language: Java #GeeksforGeeks #DSA #Java #ProblemSolving #CodingChallenge #KeepLearning #160DaysOfDSA
Maximizing Substring Partition in Java with Greedy Algorithm
More Relevant Posts
-
✅ Day 57/100 — LeetCode Challenge Problem: Transpose Matrix Language: Java Today I worked on a classic matrix operation — transposing a matrix. The goal is to convert rows into columns and vice-versa. This problem reinforced my understanding of 2D arrays and index manipulation in Java. 💡 Key Idea: If matrix has dimensions m x n, the transpose will have dimensions n x m, and each element at (i, j) becomes (j, i). 📌 Approach: Calculate row & column length Create result matrix with swapped dimensions Iterate & swap positions accordingly #100DaysOfCode #LeetCode #Java #DSA #Matrix #TechJourney #CodingChallenge #SoftwareEngineering #LearningEveryday
To view or add a comment, sign in
-
-
🚀Day 99/100 #100DaysOfLeetCode 🔍Problem: Sum of Two Integers✅ 💻Language: Java 💡Approach: Instead of using the ‘+’ or ‘–’ operators, this problem leverages bit manipulation to perform addition. 🔸Use XOR (^) to calculate the sum without carry. 🔸Use AND (&) followed by a left shift (<< 1) to calculate the carry. 🔸Repeat until no carry remains. 📚Key Takeaways: 🔹Reinforced understanding of bitwise operations. 🔹Learned how addition can be simulated using logical operations. 🔹Improved understanding of low-level arithmetic computation. ⚡Performance: ⏱️Runtime: 0 ms (Beats 100.00%) 💾Memory: 40.88 MB (Beats 10.05%) #100DaysOfLeetCode #Java #BitManipulation #CodingChallenge #ProblemSolving #DSA #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
🚀Day 88 – DSA in Java Solved “Hand of Straights” (LeetCode – Medium) Approach: ➡️ Sorted the array ➡️ Used HashMap to track frequencies ➡️ Formed consecutive groups of size k ➡️ Decremented counts as groups formed ⚡ Runtime: 24 ms (Beats 89.95%) 💾 Memory: 45.2 MB (Beats 89.4%) Explored how HashMap + sorting can simplify grouping problems and also learned about TreeMap for maintaining sorted order dynamically. #Day88 #LeetCode #Java #DSA #ProblemSolving #LearningEveryday
To view or add a comment, sign in
-
-
🔍 Java Insight of the Day -18: Method Overloading Today I explored Method Overloading, a key concept in Java that enables compile-time polymorphism. It allows multiple methods with the same name but different parameters—making code more readable and flexible. 💡 The Java compiler decides which method to invoke based on: • Method name • Number and type of parameters • Implicit type casting (type promotion) Also discovered that even the main() method can be overloaded—though only the standard signature is executed at runtime. #Java #MethodOverloading #OOP #CompileTimePolymorphism #TechLearning #WomenWhoCode #TapAcademy #100DaysOfCode #JavaDeveloper #CodingJourney #LinkedInLearning
To view or add a comment, sign in
-
-
#Day-69) LeetCode 2536: Increment Submatrices by One using a 2D difference array technique in Java — a powerful approach for handling multiple range updates efficiently. 🔧 Instead of brute-force iteration over each query, I used a prefix sum strategy to apply all updates in constant time per query, followed by a cumulative pass to build the final matrix. 🧠 Highlights: Efficient submatrix updates using difference matrix Prefix sum accumulation for final values Clean, scalable Java implementation 📌 This kind of problem is a great reminder: smart preprocessing beats brute force. Let’s connect if you’ve explored similar matrix tricks or want to brainstorm more Java optimizations! #Java #LeetCode #DSA #MatrixOptimization #CodingInPublic #ProblemSolving #TechJourney #LinkedInTech
To view or add a comment, sign in
-
-
#Day-68) LeetCode #3228 – Maximum Number of Operations to Move Ones to the End (Java Edition) Tackled this neat string problem using a greedy approach in Java. The challenge? Move '1's to the end of the string under specific movement rules, maximizing the number of valid operations. 🧠 Core Idea: Track how many '0's we've seen and how many '1's we've already moved. Only move a '1' if there's enough '0's to justify it and the next character is also '1'. 💻 Java Strategy: Loop through the string Use counters to manage '0's and '1's Let me know how you'd tweak this or if you see a more optimal path! #Java #LeetCode #GreedyAlgorithm #StringProblems #DSA #CodingChallenge #LinkedInTech #ProblemSolving
To view or add a comment, sign in
-
-
“𝒀𝒆𝒉 𝒐𝒓𝒊𝒈𝒊𝒏𝒂𝒍 𝒘𝒂𝒍𝒂 𝒌𝒚𝒖𝒏 𝒃𝒂𝒅𝒂𝒍 𝒈𝒂𝒚𝒂?” If you’ve ever asked that while cloning objects in Java — this post is for you! Here’s a simple visual breakdown of Shallow vs Deep Copy. #Java #LearningEveryday #SoftwareDevelopment #Coding
To view or add a comment, sign in
-
Ever wonder about the difference between final, finally, and finalize? Or why Strings are immutable? 🤔 I found a fantastic breakdown of key Java concepts with clear answers. Knowledge is power—start sharpening your skills today! Follow⏩ and fly✈️ #JavaProgramming #TechSkills #CodingInterview #JavaLearning #ProgrammingTips #JDKvsJRE
To view or add a comment, sign in
-
Java Bit Manipulation Practice – Finding the Rightmost Set Bit Today, I wrote a simple Java program to find the position of the rightmost set bit in a number’s binary representation. 🔹 First, the number is converted into binary using a while loop. 🔹 Then, I scan the binary string from right to left to locate the first '1'. 🔹 Finally, the program prints its position (counting starts from 1). Input: 21 Binary: 10101 Output: 1 (rightmost set bit position) It’s a great exercise for understanding bitwise logic and binary representation in Java! 💻🔥 #Java #Coding #BitManipulation #DSA #LearningJourney
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