LeetCode Practice - 11. Container with Most Water The program is solved using JAVA. 🔑 Logic Summary 1. Take two pointers (start and end) 2. Calculate area 3. Store max area 4. Move smaller height pointer 5. Repeat until pointers meet #LeetCode #Java #CodingPractice #ProblemSolving #DSA #Array #DeveloperJourney #TechLearning
LeetCode Java Container with Most Water Solution
More Relevant Posts
-
Last post we discussed why String is immutable in Java. So what if you need to modify strings frequently? 🤔 That’s where StringBuilder and StringBuffer come in. Both are mutable, but choosing the right one matters. 👉 StringBuilder = faster for single-threaded use 👉 StringBuffer = thread-safe for shared multithreaded use Swipe → to understand the real difference. 💬 Comment “code” for more Java examples. #Java #Backend #JavaDeveloper #Programming #InterviewPrep #StringBuilder
To view or add a comment, sign in
-
Day 51 – Understanding Static Concepts in Java ☕ Today I learned about static variables, static methods, and static blocks in Java. Topics covered: 🔹 Static variables and their shared nature across objects 🔹 Static methods and how they can be accessed without creating objects 🔹 Static blocks and their role in initialization Understanding how static members belong to the class rather than objects helped me gain better clarity on memory usage and execution flow in Java. Strengthening my understanding of Java internals step by step 🚀 #Day51 #JavaJourney #CoreJava #Static #JVM #Consistency
To view or add a comment, sign in
-
💻 Day 23 – Strings in Java Today I explored Strings in Java, one of the most fundamental and important concepts. I learned about different types of string handling: 🔹 String – Immutable (cannot be changed) 🔹 StringBuilder – Mutable and faster 🔹 StringBuffer – Mutable and thread-safe Understanding immutability was a key highlight today, as it plays an important role in memory management and performance. 💡 Key takeaway: Choosing the right type of string handling improves both performance and efficiency in Java applications. Continuing to strengthen my core Java concepts step by step 🚀 #Java #Strings #Programming #LearningInPublic #CodingJourney #Day23
To view or add a comment, sign in
-
-
Solved Simple Array Sum using LinkedList in Java 8 💻📊 Today I worked on the Simple Array Sum problem and implemented it using LinkedList in Java 8. 💡 What I learned: How to convert a List into a LinkedList Traversing elements efficiently using loops Using Java 8 Streams for cleaner and shorter code ⚙️ Approach: Converted input list into a LinkedList Iterated through elements and calculated sum Also explored stream().mapToInt().sum() for optimized solution 📌 Key Takeaway: Even simple problems help strengthen core concepts like data structures and improve coding efficiency. ⚡ Time Complexity: O(n) ⚡ Space Complexity: O(n) 👨💻 Consistent practice is helping me improve my problem-solving skills step by step. #Java #Java8 #LinkedList #Coding #ProblemSolving
To view or add a comment, sign in
-
-
Understanding Java Class Loading & Memory Areas Today, I learned how Java manages memory during Class Loading. It helped me understand what happens behind the scenes when a program runs. Simple Example: class Demo { static int x = 10; // Stored in Method/Class Area void show() { int y = 5; // Stored in Stack System.out.println(x + y); } } public class Main { public static void main(String[] args) { Demo obj = new Demo(); // Object stored in Heap obj.show(); } } **When this program runs: 1.Class is loaded into Method Area 2.Static variable (x) is initialized once 3.Object (obj) is created in Heap 4.Method execution happens in Stack #Java #Programming #LearningJourney #SDLC #Coding #Developer #CareerGrowth
To view or add a comment, sign in
-
-
🤯 Yesterday I learned that ArrayList is dynamic… Today I explored how it actually grows internally in Java. Here’s the simple idea 👇 👉 ArrayList internally uses a normal array 👉 When the array becomes full, Java creates a new bigger array 👉 Old elements are copied into the new one 👉 Capacity usually increases by 1.5x Example: 10 → 15 → 22 → 33 This is what makes ArrayList flexible while still being fast. 💡 Key takeaway: ArrayList looks dynamic from outside, but internally it still depends on arrays + resizing logic. Small internal details like this make Java collections much more interesting. #Java #ArrayList #DSA #LearningInPublic
To view or add a comment, sign in
-
-
Today I learned the difference between ArrayList and LinkedList in Java Collections. Both allow null values and duplicate elements, but they differ in performance and internal structure: 🔹 ArrayList: * Backed by a dynamic array * Faster for accessing elements (random access) * Slower for insertions and deletions (especially in the middle) * Provides three constructors 🔹 LinkedList: * Based on a doubly linked list * Faster for insertions and deletions * Slower for accessing elements (sequential traversal) * Provides two constructors Understanding when to use each helps in writing more efficient and optimized code. #Java #Collections #LearningJourney #DataStructures #TapAcademy
To view or add a comment, sign in
-
-
#Day88 of #100DaysOfCode Continued working on string manipulation in Java with a focus on problem-solving. Practiced: - Checking anagrams - Finding first non-repeating character - Implementing toggle case logic Focused on improving string handling and writing efficient solutions using loops and conditions. #Java #Strings #100DaysOfCode
To view or add a comment, sign in
-
Leetcode Practice - 3. Longest Substring Without Repeating Characters The problem is solved using JAVA. Start from first letter Keep adding letters until you see a duplicate When duplicate comes → move start forward Keep track of maximum length #LeetCode #Java #StringHandling #CodingPractice #ProblemSolving #DSA #DeveloperJourney #TechLearning
To view or add a comment, sign in
-
-
->A simple Java concept that’s easy to overlook 👇 Immutable Strings 🔒 String str = "hello"; str.concat(" world"); System.out.println(str); // still "hello" Strings don’t change after creation. Operations like concat() create a new object instead ♻️ str=str.concat(" world"); System.out.println(str); // "hello world" Small detail ⚡ But important while writing logic 🧠 #Java #BackendDevelopment #Programming
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