Day 17/100 – LeetCode Challenge 🚀 Problem: Fibonacci Number Approach: Used iterative dynamic programming Maintained only the last two values instead of storing the whole sequence Time Complexity: O(n) Space Complexity: O(1) Key takeaway: Dynamic programming is often about reducing repeated work, and many DP problems can be optimized to constant space. #LeetCode #100DaysOfCode #DSA #Java #ProblemSolving #InterviewPrep #100DaysOfLeetCode
Fibonacci Number LeetCode Challenge
More Relevant Posts
-
Day 24/100 – LeetCode Challenge 🚀 Problem: Climbing Stairs Approach: Recognized that the number of ways follows the Fibonacci pattern Used dynamic programming with two variables to store the previous results Iteratively computed the number of ways up to n Time Complexity: O(n) Space Complexity: O(1) Key takeaway: Many dynamic programming problems can be optimized by storing only the necessary previous states, reducing space complexity significantly. #LeetCode #100DaysOfCode #DSA #Java #DynamicProgramming #ProblemSolving
To view or add a comment, sign in
-
-
Day 31/100 – LeetCode Challenge 🚀 Problem: Roman to Integer Approach: Mapped Roman symbols to their integer values Traversed the string once If the current value was less than the next value, subtracted it Otherwise, added it to the total Time Complexity: O(n) Space Complexity: O(1) Key takeaway: When dealing with special formatting rules (like subtraction cases), comparing the current and next element often simplifies the logic. #LeetCode #100DaysOfCode #DSA #Java #Strings #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 44 Out of #365DayOfCode - LeetCode Today I worked on the Set Matrix Zeroes problem, where the goal is to modify a 2D matrix such that if any element is 0, its entire row and column are set to 0. I implemented an efficient solution with O(m × n) time complexity and optimized space usage by carefully handling matrix traversal and edge cases. This problem helped me strengthen my understanding of: 2D array manipulation In-place updates Optimizing space complexity Handling edge cases in algorithms Consistent practice is helping me improve my problem-solving skills step by step. 🚀 #DSA #Java #ProblemSolving #CodingPractice #365DaysOfCode Github link: https://lnkd.in/gGUy_MKZ
To view or add a comment, sign in
-
-
Day 20/100 – LeetCode Challenge 🚀 Problem: Subsets (Power Set) Approach: Started with an empty subset For each number in the array, created new subsets by adding the number to all existing subsets Appended the newly formed subsets to the result list Time Complexity: O(n × 2ⁿ) Space Complexity: O(n × 2ⁿ) (to store all subsets) Key takeaway: Many combinatorial problems can be solved by building results incrementally, expanding previously generated subsets. #LeetCode #100DaysOfCode #DSA #Java #ProblemSolving #Backtracking #100DaysOfLeetCode
To view or add a comment, sign in
-
-
Day 16 | LeetCode Daily Solved LeetCode Problem #173 – Binary Search Tree Iterator Concept: • Inorder traversal using stack • Iterator design over tree structures Key Learnings: • BST inorder traversal naturally gives sorted order • Using a stack allows lazy traversal with O(1) average time per operation Keeping the daily streak alive and strengthening tree traversal patterns. Submission link: https://lnkd.in/gMPEhX_m #LeetCode #DSA #BinarySearchTree #Trees #Java #ProblemSolving
To view or add a comment, sign in
-
-
100 Days of Coding Challenge – Day 1 📌 Problem: Rotate Matrix (90° Clockwise) 🧠 Concepts Used: 2D Arrays, In-place Matrix Rotation 💻 Language: Java 🔍 Platform: LeetCode Solved the classic Rotate Image problem by modifying the matrix in-place without using extra space. A great start to strengthen problem-solving with matrices! 🔗 Code: https://lnkd.in/gZJFvDYv 🔗 Problem: https://lnkd.in/gcGZp4p3 #100DaysOfCode #Day1 #Java #DSA #LeetCode #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
Day 34/100 – LeetCode Challenge 🚀 Problem: Container With Most Water Approach: Used two pointers (left & right) Calculated area using min(height[left], height[right]) × width Moved the pointer pointing to the smaller height Updated maximum area during traversal Time Complexity: O(n) Space Complexity: O(1) Key takeaway: When maximizing area between two boundaries, moving the smaller boundary is the only way to potentially increase the result. #LeetCode #100DaysOfCode #DSA #Java #TwoPointers #ProblemSolving
To view or add a comment, sign in
-
-
LeetCode Problem || Prime Number of Set Bits in Binary Representation(762)🚀 Solved an interesting bit manipulation problem today! Problem : Given two integers left and right, count how many numbers in that range have a prime number of set bits (1s) in their binary representation. This problem shows how: Binary representation connects with number theory Built-in methods like bitCount() simplify bit problems Constraint analysis helps optimize thinking Small problems like this build strong fundamentals in bit manipulation. #LeetCode #Java #BitManipulation #PrimeNumbers #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 36/100 – LeetCode Challenge 🚀 Problem: 3Sum Closest Approach: Sorted the array Fixed one element and applied the two-pointer technique Tracked the closest sum by comparing absolute differences Returned immediately if an exact match was found Time Complexity: O(n²) Space Complexity: O(1) Key takeaway: Many optimization problems are variations of classic patterns. Understanding 3Sum deeply makes solving 3Sum Closest straightforward. #LeetCode #100DaysOfCode #DSA #Java #TwoPointers #ProblemSolving #InterviewPrep
To view or add a comment, sign in
-
-
Day 40 of 100 Days of Code 🚀 Solved Maximum Consecutive Ones today. 🔹 Problem: Find the longest streak of 1’s in a binary array. 🔹 Approach: Single pass with running counter. Key idea: - Increment count when we see 1 - Reset when we see 0 - Track maximum during traversal ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) Small problems strengthen logical thinking and loop control. #LeetCode #DSA #Java #100DaysOfCode #ProblemSolving
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