Day 35 of #100DaysOfCode — Java Stacks (Part 2) completed! 📚✅ Topics Covered ✅ 1️⃣ Valid Parentheses — check if brackets are balanced 2️⃣ Duplicate Parentheses — find redundant brackets in expression → ((a+b)+(c+d)) = false | (((a+b))+c) = true 3️⃣ Maximum Rectangular Area in Histogram → Classic stack problem — O(n) solution Key Takeaway 💡 Stack shines in bracket & histogram problems! Duplicate parentheses: if two consecutive ( without operator between → duplicate 35/100 done 🔥 #100DaysOfCode #Java #Stack #DSA #ApnaCollege #BuildInPublic #JavaDeveloper
Java Stacks Part 2: Valid Parentheses & More
More Relevant Posts
-
💻 Day 25– Exception Handling in Java Today I learned about Exception Handling and honestly… this is something every program needs. Like when errors happen (divide by zero, wrong input, etc.) instead of crashing → we can handle it properly. Things I understood: 👉 try – risky code 👉 catch – handles the error 👉 finally – always runs 💡 Main thing: Errors are normal… handling them properly is what matters. Slowly getting into writing clean & reliable code 😌 #Java #CodingJourney #LearningInPublic #Day25 #100DaysOfJava
To view or add a comment, sign in
-
-
Day 24 of Java Backend Journey 💻🔥 Built a Logger System using File Handling in Java! ✔️ Stored user input into files ✔️ Implemented append mode ✔️ Displayed logs dynamically Understanding how real backend systems store data step by step 🚀 #Java #BackendDevelopment #100DaysOfCode #LearningInPublic
To view or add a comment, sign in
-
🚀 Day 12/30 – Real-World Java Development Today I was exploring wrapper classes in Java. At first, it felt like just converting primitive types into objects, but there’s more to it. In real applications, we often need objects instead of primitive values — especially when working with collections, APIs, or frameworks. Wrapper classes help in bridging that gap by allowing primitive data to be used in places where objects are required. Also noticed how features like null handling and utility methods become possible with wrapper types, which we don’t get with primitives. It’s a small concept, but it plays an important role when working with real-world applications 👍 #30DaysChallenge #Java #BackendDevelopment #LearningJourney #SoftwareEngineering
To view or add a comment, sign in
-
🔹 What is an Interface in Java? An interface is a blueprint of a class that contains only abstract methods (method without body). It tells "what to do" but not "how to do". - Example: A remote control – it has buttons, but how the TV works internally is hidden. - Key Points: ✔ All methods are abstract by default (before Java 8) ✔ Supports multiple inheritance ✔ Used to achieve 100% abstraction + Why use interface? - Improves flexibility - Supports multiple inheritance - Helps in loose coupling #fortunecloudtechnology #Java #MultipleInheritance #Interface #OOP
To view or add a comment, sign in
-
🚀 Runnable vs Callable in Java Concurrency — Quick Notes Both Runnable and Callable are Functional Interfaces ✅ 👉 That means you can use Lambda Expressions with them (Java 8+) 🔹 Runnable (Java 1.0) * Functional Interface ✔️ * Method: run() * Return Type: ❌ No return value * Exception Handling: ❌ Cannot throw checked exceptions * Use Case: Fire-and-forget background tasks 🔹 Callable (Java 5.0) * Functional Interface ✔️ * Method: call() * Return Type: ✅ Returns result (Future<V>) * Exception Handling: ✅ Can throw checked exceptions * Use Case: Tasks that need results or error handling 💡 Key Difference * Use Runnable when you don’t care about the result * Use Callable when you need a result or better exception handling ⚡ Lambda Example Runnable r = () -> System.out.println("Running task"); Callable<Integer> c = () -> 10 + 20; 🔥 In modern Java (Java 8+ to Java 21 Virtual Threads), functional style + concurrency = clean & scalable code. #Java #Concurrency #Multithreading #FunctionalProgramming #JavaDeveloper #InterviewPrep
To view or add a comment, sign in
-
-
🚀 𝗝𝗮𝘃𝗮 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗣𝗿𝗲𝗽 – Day 2 𝐖𝐡𝐚𝐭 𝐢𝐬 𝐃𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐜𝐞 𝐁𝐞𝐭𝐰𝐞𝐞𝐧 𝐉𝐃𝐊, 𝐉𝐑𝐄, 𝐚𝐧𝐝 𝐉𝐕𝐌? 🔹 𝐉𝐃𝐊 (𝐉𝐚𝐯𝐚 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐦𝐞𝐧𝐭 𝐊𝐢𝐭) • Used to develop Java applications • Contains JRE + development tools • Includes tools like compiler (javac), debugger, etc. ✅ In one line: 👉 JDK = Everything needed to build and run Java programs 🔹 𝐉𝐑𝐄 (𝐉𝐚𝐯𝐚 𝐑𝐮𝐧𝐭𝐢𝐦𝐞 𝐄𝐧𝐯𝐢𝐫𝐨𝐧𝐦𝐞𝐧𝐭) • Used to run Java applications • Contains JVM + libraries + supporting files ✅ In one line: 👉 JRE = Environment required to run Java programs 🔹 𝐉𝐕𝐌 (𝐉𝐚𝐯𝐚 𝐕𝐢𝐫𝐭𝐮𝐚𝐥 𝐌𝐚𝐜𝐡𝐢𝐧𝐞) • Executes Java bytecode • Converts bytecode into machine code • Makes Java platform independent ✅ In one line: 👉 JVM = Engine that runs Java programs 🔥 Easy Way to Remember 👉 JDK > JRE > JVM • JDK contains JRE • JRE contains JVM 🎯 Final Interview Answer 👉 JDK is used to develop Java programs, JRE is used to run them, and JVM is responsible for executing the code and making Java platform-independent. #Java #Programming #InterviewPrep #Developers #Coding #TechBasics #P_Pranjali #LearnJava #Java_Day2
To view or add a comment, sign in
-
-
One of the most underrated skills in Java: 👉 Handling exceptions the RIGHT way. Early in my career, I used to either catch and ignore exceptions or throw them without any context. Bad idea. Over time, I realized that good exception handling is not just about fixing errors — it’s about making systems more reliable and easier to debug. Here’s what I follow now: ✔ Use meaningful exception messages ✔ Don’t swallow exceptions ✔ Log with proper context (user, request, trace) ✔ Create custom exceptions when needed ✔ Fail fast, but with clarity 💡 Insight: Users don’t care what exception occurred. They care that the system works reliably. Write code that fails well — so your system recovers better. #Java #ExceptionHandling #BestPractices #CleanCode #BackendDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
Your Java Thread Model is Broken (Here's the Fix) Watch Full Video : https://lnkd.in/e_Usi8qA Website Link : https://systemdrd.com/ Full Course Link : https://lnkd.in/eM5jJyaQ OS threads cost 1MB each and cap you at ~2,000 connections. Java's virtual threads via Project Loom handle 1,000,000+ — with simpler code. Stop writing reactive chains. #JavaDeveloper #ProjectLoom #VirtualThreads #BackendEngineering #JavaTips #CodingShorts #SoftwareEngineering #Java2026
To view or add a comment, sign in
-
🚀 Defining and Calling a Simple Java Method This code demonstrates how to define a simple method in Java and call it from the main method. The `addNumbers` method takes two integer arguments, calculates their sum, and prints the result to the console. Calling the method involves using its name followed by parentheses, providing the required arguments. This example illustrates the basic syntax and usage of methods in Java, emphasizing their role in encapsulating functionality. #Java #JavaDev #OOP #Backend #professional #career #development
To view or add a comment, sign in
-
-
Most Java developers use primitives. But very few actually understand when NOT to use them. Here’s the truth 👇 In Java, "int", "double", "boolean" are primitives. They are: • Fast • Memory efficient • Simple But they come with hidden limitations: ❌ Cannot be "null" ❌ No built-in methods ❌ Not usable in Collections ("List<int>" won’t work) Now comes the powerful alternative: Wrapper Classes "Integer", "Double", "Boolean"... They bring: ✅ Null support ✅ Built-in utility methods ✅ Full compatibility with Collections & Generics So what’s the real rule? → Use primitives for performance-critical logic → Use wrappers when working with APIs, forms, or collections The difference looks small. But in real-world applications, it changes everything. #Java #Programming #BackendDevelopment #JavaDeveloper #CleanCode
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