🚀 Day 23 / 180 – DSA with Java 🚀 📘 Topic Covered: Linked List Manipulation 🧩 Problem Solved: Delete Node in a Linked List Problem: Given a node in a singly linked list (not the head), delete that node without access to the previous node. Approach: Since the previous node is not accessible, copied the value of the next node into the current node and updated the pointer to skip the next node, effectively deleting it. Key Learning: ✔️ Thinking differently when constraints change ✔️ Understanding pointer manipulation in linked lists ✔️ Solving problems by modifying node structure directly If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #LinkedList #ProblemSolving #Consistency
Delete Node in Linked List with Java DSA
More Relevant Posts
-
🚀 Day 30 / 180 – DSA with Java 🚀 📘 Topic Covered: Strings & Sorting Technique 🧩 Problem Solved: Longest Common Prefix Problem: Given an array of strings, find the longest common prefix shared among all the strings. Approach: Sorted the array of strings and compared only the first and last strings. Since sorting groups similar prefixes together, the common prefix between these two strings represents the common prefix for the entire array. Key Learning: ✔️ Using sorting to simplify string comparison problems ✔️ Observing patterns to reduce unnecessary checks ✔️ Efficient prefix detection in string arrays If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Strings #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
Day 21 of My DSA Journey Solved “Perfect Number” using Java. Problem Summary A perfect number is a positive integer that is equal to the sum of its proper divisors (excluding itself). Example: 28 → divisors are 1, 2, 4, 7, 14 → sum = 28 Approach Initially, I checked all divisors up to n/2. This works but is inefficient for larger numbers. Then I optimized the solution by iterating only up to √n. For every divisor i, there exists a corresponding pair (n / i). So instead of checking all numbers, we only check till √n and add both divisors. Important points: • Start sum = 1 (since 1 is always a divisor) • Avoid counting the square root twice when i == n / i • Exclude the number itself from the sum Optimization Insight Divisors always occur in pairs. Using this property significantly reduces the number of iterations. Complexity Time Complexity: O(√n) Space Complexity: O(1) Key Learning A brute-force solution may work, but understanding mathematical properties helps in optimizing it. Thinking in terms of patterns and divisor behavior leads to better solutions. #DSA #LeetCode #Java #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🧩 DSA Practice – Array Problems in Java Today I worked on strengthening array fundamentals by solving a few small problems: • Searching an element and returning its index • Counting even numbers in an array • Finding the second largest element without sorting • Reversing an array using a two-pointer approach These exercises helped reinforce traversal logic, condition checks, and efficient problem-solving without relying on built-in shortcuts. Consistently practicing the basics helps build stronger algorithmic thinking. #Java #DSA #LearningInPublic #ProgrammingFundamentals #DeveloperJourney
To view or add a comment, sign in
-
🚀 Day 25 / 180 – DSA with Java 🚀 📘 Topic Covered: Binary Search (First & Last Occurrence) 🧩 Problem Solved: Find First and Last Position of Element in Sorted Array Problem: Given a sorted array and a target value, find the starting and ending position of the target in O(log n) time. If not found, return [-1, -1]. Approach: Used Binary Search twice — • First to find the leftmost (first) occurrence • Then to find the rightmost (last) occurrence By carefully adjusting the search boundaries, ensured both positions were located efficiently. Key Learning: ✔️ Extending binary search for range queries ✔️ Handling boundary conditions carefully ✔️ Maintaining O(log n) time complexity If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #BinarySearch #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 29 / 180 – DSA with Java 🚀 📘 Topic Covered: Arrays & Two-Pointer Technique 🧩 Problem Solved: Container With Most Water Problem: Given an array where each element represents the height of a vertical line, find two lines that together with the x-axis form a container that holds the maximum amount of water. Approach: Used a two-pointer strategy starting from both ends of the array. Calculated the water area using the shorter height and the distance between pointers, then moved the pointer with the smaller height to try finding a better container. Key Learning: ✔️ Efficient use of two-pointer technique ✔️ Understanding how pointer movement impacts optimization ✔️ Reducing brute-force O(n²) solutions to O(n) If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Arrays #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 24 / 180 – DSA with Java 🚀 📘 Topic Covered: Binary Search & Lower Bound Concept 🧩 Problem Solved: Search Insert Position Problem: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it should be inserted to maintain sorted order. Approach: Applied Binary Search while maintaining a potential answer index. Whenever the middle element was greater than or equal to the target, updated the answer and moved left to find the smallest valid position. Key Learning: ✔️ Understanding lower bound logic ✔️ Using binary search beyond simple searching ✔️ Achieving O(log n) efficiency with precise conditions If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #BinarySearch #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 50 Days of Java – Day 38 🚀 Continuing my #50DaysOfJava journey by implementing Queue using Array (Linear Queue) in Java 💻 📘 What I covered today: • Implemented Linear Queue using Array • Understood FIFO (First In, First Out) concept • Performed queue operations: "enqueue", "dequeue", and "peek" • Learned conditions for queue overflow and underflow Implementing Queue from scratch helped me understand how data flows sequentially and how memory is managed internally. Sharing my daily learning and code to stay consistent 🚀 🔗 GitHub repo: (https://lnkd.in/g-g5rVyM) Step by step strengthening my DSA concepts 💪 #Java #50DaysOfJava #Day38 #Queue #LinearQueue #DataStructures #DSA #LearningInPublic #CodingJourney #Bca #Student
To view or add a comment, sign in
-
🚀 Day 34 / 180 – DSA with Java 🚀 📘 Topic Covered: Arrays & Basic Construction 🧩 Problem Solved: Concatenation of Array Problem: Given an integer array nums, create a new array that contains the elements of nums twice in sequence. Approach: Created a new array with double the size of the original array and filled the first half with the original elements, then copied the same elements again into the second half. Key Learning: ✔️ Practicing array construction and indexing ✔️ Understanding how to manipulate array sizes ✔️ Writing clean logic for simple transformation problems If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Arrays #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 Day 31 / 180 – DSA with Java 🚀 📘 Topic Covered: Strings & Substring Search 🧩 Problem Solved: Find the Index of the First Occurrence in a String Problem: Given two strings haystack and needle, return the index of the first occurrence of needle in haystack. If it is not present, return -1. Approach: Traversed the main string and checked potential starting positions where the first character matched. Then compared the substring of the same length as the target string to verify a complete match. Key Learning: ✔️ Understanding substring search logic ✔️ Optimizing comparisons by checking the first character first ✔️ Practicing careful boundary handling in string traversal If you’re also preparing for DSA, let’s connect and learn together 🤝 #DSA #Java #180DaysOfCode #LearningInPublic #Strings #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
🚀 DSA Learning Journey | Day 9 | Java Solved “125. Valid Palindrome.” 💡 Key Idea: Used Two Pointers while ignoring non-alphanumeric characters and comparing characters in a case-insensitive way. ⚙ Implementation • Language: Java • Time Complexity: O(n) • Space Complexity: O(1) 📚 Learning how two-pointer technique simplifies string validation problems. #Java #DSA #LeetCode #ProblemSolving #TwoPointers #JavaDeveloper
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