✅ DSA Day 7 / 100 Solved Median of Two Sorted Arrays on LeetCode using Java. Logic : - Combine both sorted arrays into one array -Sort the merged array - Find the middle index - If the total length is odd → median is the middle element -If even → median is the average of the two middle elements #DSA #100DaysOfCode #Java #LeetCode #BeginnerDSA #LearningInPublic #Consistency
Median of Two Sorted Arrays Solved on LeetCode with Java
More Relevant Posts
-
✅ DSA Day 8 / 100 Solved Reverse an Array on HackerRank using Java. Problem: Given an array, return the array in reverse order. Logic : - Use the built-in method Collections.reverse() -This method reverses the elements of the list directly -Then return the reversed list This problem helped me understand how arrays/lists can be manipulated easily using Java utility methods. #DSA #100DaysOfCode #Java #HackerRank #LearningInPublic #BeginnerDSA
To view or add a comment, sign in
-
-
Day 3/50 | #50DaysOfCode 📍 Platform: LeetCode 💻 Language: Java ✅ 2520. Count the Digits That Divide a Number (Easy) Today’s problem focused on digit extraction and divisibility checks. It helped strengthen my understanding of number manipulation and conditional logic. 🔎 Approach: Extract each digit using modulus (%) Check if the digit divides the original number using modulo If divisible, increment the counter Continue until all digits are processed Return the final count 📌 Example: Input: num = 1248 Output: 4 Explanation: All digits (1, 2, 4, 8) divide 1248 evenly This problem improved my understanding of loops, digit handling, and divisibility logic in Java. #DSA #LeetCode #Java #CodingJourney #ProblemSolving #Consistency #LearningJourney #50DaysOfCode #LinkedIn
To view or add a comment, sign in
-
-
Just dropped a new video on Comparator Interface in Java — covering custom sorting logic using multiple approaches (class, anonymous class and lambda). A clean, visual explanation to make sorting truly click. #Java #Comparator #Coding #LearningEveryday Watch here: https://lnkd.in/geW_UKh9
Master Comparator in Java | Custom Sorting Logic Using Class, Anonymous & Lambda
https://www.youtube.com/
To view or add a comment, sign in
-
Many developers ask: Why do Java Collections not support primitive data types? The reason is that Java Collections work with objects, not primitives. To handle primitive values, Java uses Wrapper Classes like Integer, Double, and Character. Example: int → Integer double → Double char → Character This process is called Autoboxing and Unboxing. Understanding such small concepts can make a big difference in mastering Java. 🚀 #CoreJava #JavaTips #Programming #JavaDeveloper
To view or add a comment, sign in
-
🧬 Java Collections – ArrayList Deep Dive Yesterday I explored ArrayList in more detail. ✔️ Looping through elements ✔️ Using methods like remove(), contains(), and size() Understanding these operations helps in managing dynamic data effectively in Java. Also practiced DSA problems like: • Removing even numbers from a list • Finding common elements between two lists Strengthening both collection usage and problem-solving together. 🚀 #Java #Collections #DSA #LearningInPublic #BackendDevelopment #DeveloperJourney
To view or add a comment, sign in
-
#100daysofcodingchallenge - Day14 Question: Write a Java program to read an array of integers and print the minimum and maximum sum of n-1 elements from the array. Input: Enter number of elements: 5 Enter elements: 1 2 3 4 5 Output: Minimum sum of n-1 elements: 10 Maximum sum of n-1 elements: 14 #100daysofcodingchallenge #codingchallenge #day14 #practicecoding #corejava #problemsolving
To view or add a comment, sign in
-
-
Day 62 of #100DaysOfLeetCode 💻✅ Solved #219. Contains Duplicate II problem in Java. Approach: • Used two nested loops to compare elements within range k • For each element, checked next k elements • If any duplicate is found within distance k, returned true • If no such pair exists, returned false Key Learning: ✓ Practiced checking duplicates within a given range ✓ Strengthened understanding of array traversal with conditions ✓ Learned the importance of optimizing nested loop solutions Learning one problem every single day 🚀 #Java #LeetCode #DSA #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Entry-level Algorithm Challenge: Array Manipulation in Java. Today I tackled a foundational exercise: reading a list of numbers and filtering out only the negative values. It was a great opportunity to reinforce some core Java concepts: 1. Flow control with do-while loop: Ensuring valid input within a specific range. 2. Simplified iteration with for-each loop: Improving code readability. 3. Handling flags (boolean signals): Providing clear, user-friendly feedback. Check out the logic below! 👇 #Java #Algorithms #SoftwareDevelopment #Coding
To view or add a comment, sign in
-
-
Many developers overlook a small but important difference in Java: == vs .equals() String s1 = new String("Java"); String s2 = new String("Java"); System.out.println(s1 == s2); // false System.out.println(s1.equals(s2)); // true ✔ == compares memory references (whether both variables point to the same object). ✔ .equals() compares the actual content of the objects. Even though s1 and s2 contain the same value, they are stored as different objects in memory, so == returns false. 💡 This distinction becomes critical when working with collections like HashMap, HashSet, or custom objects. Strong Java fundamentals often come down to understanding small details like these. #Java #Programming #JavaDeveloper #Coding #SoftwareEngineering LinkedIn Guide to Networking LinkedIn Learning Community LinkedIn Learning
To view or add a comment, sign in
-
-
Day 41 of #100DaysOfLeetCode 💻✅ Solved #242. Valid Anagram problem in Java. Approach: • Converted both strings to lowercase to ensure case-insensitive comparison • Converted the strings into character arrays • Sorted both arrays using Arrays.sort() • Compared the sorted arrays using Arrays.equals() • If both arrays match, the strings are anagrams Performance: ✓ Runtime: 11 ms (Beats 28.32% submissions) ✓ Memory: 46.83 MB (Beats 8.28% submissions) Key Learning: ✓ Practiced string manipulation and character array handling in Java ✓ Understood how sorting helps in comparing character frequencies ✓ Strengthened problem-solving skills for string-based problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
Explore related topics
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