🚀Day 7 of #120DaysOfCode 📌 Problem: Find all numbers disappeared in an Array(448) 📌 Language: Java 🔍Approach: Using HashSet . Store all elements of nums in a set . Loop from 1 to n . If a number is not in the set --> it's missing ⏱️ Time and Space Complexity Time Complexity: O(n) Space complexity: O(n) 🔥One problem closer to mastery #120DaysOfCode #Day6 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
Find Missing Numbers in Java Array with HashSet
More Relevant Posts
-
🚀Day 14 of #120DaysOfCode 📌 Problem: Matrix Reshape(566) 📌 Language: Java 🔍Approach 1. Check if Reshape is possible 2. Traverse the original matrix in row order 3. Mapping logic ⏱️ Time and Space Complexity Time Complexity: O(m x n) Space complexity: O(r x c) 🔥One problem closer to mastery #120DaysOfCode #Day14 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
To view or add a comment, sign in
-
-
🚀 Day 2 | Problem 1 of my 15-Day 50+ String DSA Challenge Problem: Find Length of a String (without using length()) Today I practised a basic but important string problem in Java and focused on understanding different looping approaches. Key learnings: • Calculated string length without using built-in methods • Understood the difference between `for` loop and `for-each` loop • Learned when index-based iteration is needed and when simple traversal is enough Strengthening fundamentals step by step 💪 #DSA #Java #StringProblems #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
🚀Day 20 of #120DaysOfCode 📌 Problem: Reverse Integer(7) 📌 Language: Java Algorithm: 1. Initialize rev = 0 2. While x != 0 . Extract digit . Check overflow . Update rev 3. Return rev ⏱️ Time and Space Complexity Time Complexity: O(logn) Space complexity: O(1) 🔥One problem closer to mastery #120DaysOfCode #Day20 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
To view or add a comment, sign in
-
-
🚀Day 13 of #120DaysOfCode 📌 Problem: Reverse String(344) 📌 Language: Java 🔍Approach(Two Pointer Technique) 1. Use two pointer . left --> start of the array index . right --> end of the array 2. While left < right: . Swaps[left] and s[right] . Move left forward (left++) . Move right backward (right--) 3. Stop when pointers meet or cross ⏱️ Time and Space Complexity Time Complexity: O(n) Space complexity: O(1) 🔥One problem closer to mastery #120DaysOfCode #Day13 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #Akshay #DSA
To view or add a comment, sign in
-
-
day 92/100 #leetcodegrinding The number of rotations equals the index of the minimum element in the array. Using binary search, we can find this efficiently in O(log n) time. 🧠 What I focused on: Identifying the pivot (minimum element) Handling rotated vs non-rotated cases Applying binary search with correct boundaries Writing a clean and efficient Java solution This problem really strengthens understanding of rotated arrays and search logic. Keeping the streak alive 🚀 #DSA #ProblemSolving #Java #BinarySearch #Arrays #LeetCode #CodingPractice #DailyLearning
To view or add a comment, sign in
-
-
day 93/100 #leetcodegrind “Find Minimum in a Sorted Rotated Array” problem — a classic example of Binary Search in action. 💡 Key idea: In a rotated sorted array, the minimum element is the pivot. By comparing mid and high elements, we can efficiently narrow the search space to find the minimum in O(log n) time. 🧠 What I practiced: Binary search on rotated arrays Identifying the pivot element efficiently Handling edge cases like non-rotated arrays Writing clean and optimized Java code It’s a simple problem, but it reinforces the power of binary search in non-traditional ways. Rotation? No problem! 🔄🚀 #DSA #ProblemSolving #Java #BinarySearch #Arrays #LeetCode #CodingPractice #DailyLearning
To view or add a comment, sign in
-
-
DSA journey 🚀 📌 LeetCode #977 – Squares of a Sorted Array 💻 Language: Java 🔹 Approach (Two Pointer Technique): Initialize two pointers at the start and end of the array Compare squares of both ends Place the larger square at the end of the result array Move pointers inward accordingly Continue until all elements are processed This works because the array is already sorted, but negative numbers can produce larger squares 💡 ⏱ Time Complexity: O(n) 🧩 Space Complexity: O(n) Efficient and elegant ✨ Consistency over perfection 💯 #DSA #Java #LeetCode #ProblemSolving #LearningInPublic
To view or add a comment, sign in
-
-
🚀Day 9 of #120DaysOfCode 📌 Problem: Largest Number At Least Twice of Others(747) 📌 Language: Java 🔍Approach 1. Traverse the array once to find the largest (max1) and second largest (max2) elements. 2. While updating the largest element, also store it's index. 3. After traversal, check if max >= 2 * max2 4. If true, return the stored index; otherwise, return -1. ⏱️ Time and Space Complexity Time Complexity: O(n) Space complexity: O(1) 🔥One problem closer to mastery #120DaysOfCode #Day9 #Java #Array #Leetcode #ProblemSolving #Consistency #LearningEveryday #LearningPublic #DSA
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