Day 65 - DSA Practice Solved LeetCode 237 – Delete Node in a Linked List. The catch is you don’t get the head or the previous node, so the usual deletion approach doesn’t work. Instead, copy the value from the next node and link to the node after it. This effectively removes the given node. Simple problem, but a good reminder to think differently when constraints block the obvious approach. #DSA #LeetCode #Java
Delete Node in LeetCode Linked List
More Relevant Posts
-
🚀 Day 17/30 – LeetCode Java Challenge Back to a cleaner problem today — focused on tracking indices and minimizing distance. 📊 Result: ✔️ Accepted (899/899 test cases) ⚡ Runtime: 4 ms 💾 Memory: Could be improved 💡 What I learned: HashMaps are useful, but not always the most optimal choice Storing unnecessary data increases memory usage There’s often a simpler approach if you think deeper Let’s be honest: This solution works, but it’s not the most efficient in terms of memory. There’s a better way without storing full lists. Day 17 done. More focus on optimizing space, not just time. Bavani k Deepika Kannan Divya Suresh Hari priya B Devipriya R Archana J E Bhavya B Harini B Kezia H Vaishnavi Janaki #LeetCode #Java #DSA #ProblemSolving #Consistency #30DaysOfCode
To view or add a comment, sign in
-
-
Day 64 — LeetCode Progress (Java) Problem: Remove Element Required: Given an array nums and a value val, remove all occurrences of val in-place and return the new length of the array. Idea: Use a two-pointer approach to overwrite unwanted elements while maintaining the order of remaining elements. Approach: Maintain a pointer k to track the position of valid elements. Traverse the array: If the current element is not equal to val, place it at index k Increment k All valid elements are moved to the front of the array. Return k as the new length. Time Complexity: O(n) Space Complexity: O(1) #LeetCode #DSA #Java #TwoPointers #Arrays #Algorithms #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀Day 2/100 – LeetCode Journey Today’s problem: Two Sum II (Sorted Array) 💡Approach (Two Pointer Method) Since the array is sorted, I used two pointers: One at the start (i) One at the end (j) 👉Logic: If nums[i] + nums[j] == target → return answer ✅ If sum is greater → move j-- If sum is smaller → move i++ In this problem, we return 1-based index → so answer is (i + 1, j + 1) ⚡Time Complexity: O(n) → single pass using two pointers 🧠 Space Complexity: O(1) → no extra space used 🙌 Thanks to RAVI KUMAR Sir for guidance! . . #100DaysOfCode #LeetCode #DSA #Java
To view or add a comment, sign in
-
-
Mastering Virtual Threads in Java 21 – The Game-Changer for Ultra-High-Throughput Backend Services 🔥 As a Java Developer who has scaled systems to handle 500K+ concurrent requests, I can confidently say: Virtual Threads (Project Loom) is the biggest revolution in Java concurrency since the introduction of the Fork/Join framework. Gone are the days of thread-pool hell, context-switching overhead, and “one thread per request” limitations. Pro tip from production trenches: Combine Virtual Threads with Structured Concurrency (Java 22 preview) and you get automatic cancellation + clean error handling – the holy grail of backend engineering. Who else is already running Virtual Threads in production? Drop your experience or biggest challenge in the comments 👇 I reply to every single one. #Java #Java21 #VirtualThreads #SpringBoot #Microservices #BackendDevelopment #HighScaleSystems #JavaPerformance #JavaDeveloper #BackendEngineer
To view or add a comment, sign in
-
-
While building a recent Spring Boot application, I realized... The Hook: Stop defaulting to .parallelStream() to make your Java code "faster." 🛑 The Insight: It’s a common misconception that parallel streams always improve performance. Under the hood, parallelStream() uses the common ForkJoinPool. If you are executing CPU-intensive tasks on a massive dataset, it’s great. But if you are doing I/O operations (like database calls or network requests) inside that stream, you will exhaust the thread pool and bottleneck your entire application. The Pro Tip: Always benchmark. For I/O bound tasks, look into asynchronous programming (like CompletableFuture) or Java 21's Virtual Threads instead of parallel streams. #Java #PerformanceOptimization #SoftwareEngineering #CleanCode
To view or add a comment, sign in
-
🚀 Day 53 of My Java DSA Journey Today I worked on a Linked List pointer manipulation problem. 💡 Problem: Merge In Between Linked Lists 👉 Given two linked lists, remove nodes from index a to b in list1 and insert list2 in their place. 🧠 Approach: • Traversed to node at position a-1 • Traversed to node at position b • Found the last node of list2 • Reconnected pointers to merge lists efficiently 🔗 Key Idea: Instead of creating new nodes, I directly manipulated pointers to connect: (a-1) → list2 end of list2 → (b+1) ⚡ What I learned: • Pointer manipulation is crucial in linked lists • Traversal control matters for correct connections • Efficient solutions avoid extra memory 🎯 Takeaway: Mastering pointer logic is key to solving Linked List problems. #Day53 #90DaysOfCoding #DSA #Java #LinkedList #CodingJourney
To view or add a comment, sign in
-
-
Day 65 — LeetCode Progress (Java) Problem: Find All Numbers Disappeared in an Array Required: Given an array of size n containing numbers in the range [1, n], return all the numbers that are missing from the array. Idea: Compare the expected range [1…n] with the actual elements to identify missing values. Approach: Initialize a set containing all numbers from 1 to n. Traverse the array: Remove each element from the set The remaining elements in the set are the missing numbers. Time Complexity: O(n) Space Complexity: O(n) #LeetCode #DSA #Java #HashSet #Arrays #Algorithms #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
If you’re still using "𝐧𝐞𝐰 𝐓𝐡𝐫𝐞𝐚𝐝()" in Java… You’re already behind. 👇 Creating threads manually is expensive: 👉Memory overhead 👉CPU context switching 👉No control over execution And in production? 👉 It kills scalability. Modern Java solves this with the 𝐄𝐱𝐞𝐜𝐮𝐭𝐨𝐫 𝐅𝐫𝐚𝐦𝐞𝐰𝐨𝐫𝐤 Instead of creating threads: 👉 You manage 𝐭𝐡𝐫𝐞𝐚𝐝 𝐩𝐨𝐨𝐥𝐬 Why this matters: ✔ Threads are reused ✔ Better performance ✔ Controlled concurrency ✔ Safer under load But here’s where most developers go wrong: More threads ≠ faster application ❌ Too many threads lead to: 👉CPU thrashing 👉Context switching overhead 👉Performance degradation 💡 Pro rule: CPU-bound tasks → threads ≈ number of cores IO-bound tasks → can scale higher And always: 👉 𝙚𝙭𝙚𝙘𝙪𝙩𝙤𝙧.𝙨𝙝𝙪𝙩𝙙𝙤𝙬𝙣() (don’t leak resources) Concurrency isn’t about doing everything at once. It’s about doing the 𝐫𝐢𝐠𝐡𝐭 𝐭𝐡𝐢𝐧𝐠𝐬 𝐞𝐟𝐟𝐢𝐜𝐢𝐞𝐧𝐭𝐥𝐲. #Java #Concurrency #Multithreading #Scalability #Backend
To view or add a comment, sign in
-
🚀 Day 58/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 278. First Bad Version Used binary search on answer space to efficiently find the first bad version while minimizing API calls. ⏱️ Time Complexity: O(log n) 📦 Space Complexity: O(1) Strengthening understanding of binary search optimization and decision-based problems. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 37 of My Java DSA Journey✨ Today I focused on improving my logic building skills and practiced problems using: 💡 Nested If-Else Conditions • Solved problems that required multiple condition checks • Learned how to structure logic clearly without confusion 🔄 Array Rotation • Understood how elements shift positions in an array • Practiced rotating arrays and tracking index changes 🔍 What I learned today: • Breaking complex conditions into smaller steps • Writing clean and readable logic • Importance of index handling in arrays ⚡ These problems may look simple, but they are essential for building strong problem-solving skills. 🎯 Takeaway: Strong logic + array basics = foundation for advanced DSA #Day36 #90DaysOfCoding #Java #DSA #Arrays #ProblemSolving #CodingJourney #Consistency
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