Day 86 of #100DaysOfLeetCode 💻✅ Solved #238. Product of Array Except Self problem in Java. Approach: • Calculated prefix (left) products • Traversed from right to maintain suffix product • Combined both without using extra space • Avoided division for optimal solution Performance: ✓ Runtime: 2 ms (Beats 95.11% submissions) 🚀 ✓ Memory: 72.10 MB (Beats 31.81% submissions) Key Learning: ✓ Learned prefix and suffix product technique ✓ Improved space optimization skills ✓ Understood how to avoid division in array problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #Arrays #PrefixSum #ProblemSolving #CodingJourney #100DaysOfCode
Solved LeetCode 238 Product of Array Except Self in Java
More Relevant Posts
-
🚀 Day 52/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 3174. Clear Digits Used a stack-like approach with StringBuilder to remove the closest non-digit character whenever a digit is encountered. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) Strengthening understanding of string processing and stack-based logic simulation. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 92 of #100DaysOfLeetCode 💻✅ Solved #739. Daily Temperatures problem in Java. Approach: • Used Monotonic Stack to track indices • Compared current temperature with stack top • Updated result when a warmer day was found • Stored indices for future comparisons Performance: ✓ Runtime: 60 ms (Beats 79.01% submissions) 🚀 ✓ Memory: 107.89 MB (Beats 17.53% submissions) Key Learning: ✓ Learned Monotonic Stack technique ✓ Improved handling of next greater element problems ✓ Strengthened stack-based problem solving Learning one problem every single day 🚀 #Java #LeetCode #DSA #Stack #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 7 of #LeetCode Challenge 🔍 Problem: Sqrt(x) 💡 Approach: Used the built-in Math.sqrt() function to compute the square root and then typecasted it to an integer to get the floor value. 🧠 Key Concept: Understanding how to convert a floating-point result into an integer using typecasting. 🔥 #Day7 #LeetCode #Java #DSA #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 78 of #100DaysOfLeetCode 💻✅ Solved #299. Bulls and Cows problem in Java. Approach: • Used a frequency array to track digits • Counted bulls when characters matched directly • Used count array to efficiently track cows • Updated counts to handle unmatched digits Performance: ✓ Runtime: 3 ms (Beats 95.59% submissions) 🚀 ✓ Memory: 43.64 MB (Beats 52.40% submissions) Key Learning: ✓ Learned efficient use of frequency arrays ✓ Improved handling of strings with counting logic ✓ Strengthened understanding of bulls vs cows logic Learning one problem every single day 🚀 #Java #LeetCode #DSA #Strings #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 32 of #50DaysLeetCode Challenge 💻🔥 Today I solved the “Rotate Image” problem using Java. 🔹 Problem: Given an n × n matrix, rotate the image 90° clockwise in-place (no extra matrix allowed). 🔹 Where people mess up: Trying to simulate rotation directly with extra space. That defeats the whole point of the problem. 🔹 Optimal Approach: 1. Transpose the matrix (swap rows & columns) 2. Reverse each row That’s it. Two clean steps. No overthinking. 🔹 Key Insight: Rotation isn’t magic — it’s just a combination of simple transformations. 🔹 Time Complexity: O(n²) 🔹 Space Complexity: O(1) 📌 What I learned: Most matrix problems look complicated until you break them into small predictable operations. If your approach feels messy, you’re probably doing it wrong. Simple > Clever. #Day32#LeetCode #Java #Matrix #DSA #CodingChallenge #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 48 of My #LeetCode Journey Today’s problem: 2615. Sum of Distances 💡 Key Idea: Instead of calculating distances between equal elements using brute force (O(n²)), I used: HashMap to group indices of same values Prefix Sum to efficiently compute distances This reduced the complexity to O(n) 🔥 🧠 What I Learned: How prefix sums can optimize distance calculations Efficient handling of repeated elements Writing clean and optimized code using Java ⚡ Approach: Store indices of each number Use prefix sums to calculate left & right distances Combine both to get final answer 📈 Time Complexity: O(n) 📦 Space Complexity: O(n) Consistency is key. Small progress every day leads to big results 💪 #Day48 #Java #FullStackDeveloper #CodingJourney #100DaysOfCode #DSA #LeetCode
To view or add a comment, sign in
-
Day 87 of #100DaysOfLeetCode 💻✅ Solved #334. Increasing Triplet Subsequence problem in Java. Approach: • Used Greedy approach with two variables • Tracked smallest and second smallest values • Updated values while traversing array • Returned true when a valid triplet was found Performance: ✓ Runtime: 2 ms (Beats 99.30% submissions) 🚀 ✓ Memory: 122.40 MB (Beats 80.69% submissions) Key Learning: ✓ Learned efficient Greedy strategy for subsequences ✓ Improved tracking of minimum values dynamically ✓ Strengthened understanding of pattern detection in arrays Learning one problem every single day 🚀 #Java #LeetCode #DSA #Greedy #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
DSA Practice Update Today I solved: #876 – Middle of the Linked List Learned how to efficiently find the middle node of a linked list using the fast and slow pointer approach. Understood how moving one pointer twice as fast as the other helps identify the middle element in a single traversal. Key Learnings: • Fast and slow pointer technique • Efficient traversal of linked lists • Solving problems in O(n) time with constant space This problem strengthened my understanding of pointer-based techniques, which are very useful in linked list problems. Continuing to stay consistent and improve problem-solving skills step by step. #DSA #LeetCode #CodingJourney #Java #SoftwareDevelopment #PlacementPreparation
To view or add a comment, sign in
-
-
Day 93 - LeetCode Journey Solved LeetCode 9: Palindrome Number in Java ✅ At first glance, it feels like a string problem… but the real challenge is solving it without converting to string. Instead of reversing the whole number, I reversed only half of it and compared both parts. This avoids overflow and keeps it efficient. Smart approach > brute force 💡 Key takeaways: • Handling edge cases (negative numbers, trailing zeroes) • Reversing only half of the number • Avoiding extra space (no string conversion) • Writing optimized mathematical logic ✅ All test cases passed ⚡ O(log n) time and O(1) space Sometimes the best solutions are the simplest ones, just a different way of thinking 🔥 #LeetCode #DSA #Java #Math #ProblemSolving #CodingJourney #InterviewPrep #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
Day 79 of #100DaysOfLeetCode 💻✅ Solved #3. Longest Substring Without Repeating Characters problem in Java. Approach: • Used Sliding Window with HashSet • Expanded window using right pointer • Shrunk window when duplicate found • Tracked maximum substring length Performance: ✓ Runtime: 6 ms (Beats 69.53% submissions) 🚀 ✓ Memory: 46.46 MB (Beats 41.45% submissions) Key Learning: ✓ Strengthened Sliding Window technique ✓ Learned efficient duplicate handling using HashSet ✓ Improved substring optimization skills Learning one problem every single day 🚀 #Java #LeetCode #DSA #SlidingWindow #Strings #ProblemSolving #CodingJourney #100DaysOfCode
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