Day 68 of #100DaysOfCode 🚀 Today I implemented Pascal’s Triangle using Java. At first glance, it looks like just a pattern problem. But internally, it teaches something powerful — building current state from previous state. 🔹 The first and last elements of every row are always 1 🔹 Every middle element = sum of two elements from the previous row 🔹 This is a classic example of bottom-up thinking Instead of hardcoding values, we dynamically generate each row based on the previous one. This problem strengthened: Nested loop understanding 2D List handling in Java Pattern recognition Thinking in terms of recurrence Small problems. Strong foundations. Consistent progress. On to the next one 💪 #100DaysOfCode #Java #DSA #ProblemSolving #LearningInPublic #dsawithkunal
Implementing Pascal's Triangle in Java with Bottom-Up Thinking
More Relevant Posts
-
Day 21 of #100DaysOfLeetCode 💻✅ Solved #27. Remove Element problem on LeetCode in Java. Approach: • Used a two-pointer technique to modify the array in-place • Maintained a pointer k to place elements not equal to val • Iterated through the array and skipped elements equal to val • Placed non-val elements at the k-th position and incremented k • Returned k as the number of remaining elements Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 44 MB (Beats ~75% submissions) Key Learning: ✓ Strengthened understanding of in-place array manipulation ✓ Learned how to skip unwanted elements efficiently ✓ Improved confidence in two-pointer techniques for array problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
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
-
-
🚀 DSA Day 5 / 100 Solved the Two Sum problem on LeetCode using Java. Logic : • Go through the array one number at a time • For each number, check what value is needed to reach the target • Store each number with its index in a HashMap • If the needed value is already stored, we’ve found the answer #DSA #100DaysOfCode #Java #LeetCode #BeginnerDSA #LearningStepByStep #Consistency
To view or add a comment, sign in
-
-
Day 23 of #100DaysOfLeetCode 💻✅ Solved #19. Remove Nth Node From End of List on LeetCode using Java. Approach: • Used a dummy node to handle edge cases (like removing the head) • Initialized two pointers: fast and slow • Moved fast pointer n+1 steps ahead to maintain a gap • Traversed both pointers together until fast reached null • Slow pointer stopped just before the node to delete • Updated links to remove the target node in one pass Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 43.77 MB Key Learning: ✓ Mastered two-pointer (fast & slow) technique ✓ Understood importance of dummy node for edge cases ✓ Solved the problem in a single traversal (O(n) time, O(1) space) Consistency is building confidence 🚀 #Java #LeetCode #DSA #LinkedList #TwoPointers #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
Day 39 of #100DaysOfLeetCode 💻✅ Solved #258. Add Digits problem in Java. Approach: • Used a loop to repeatedly add all digits of the number • Extracted each digit using modulus (%) and divided the number by 10 • Stored the digit sum and repeated the process until the result became a single digit • Returned the final single digit as the answer Performance: ✓ Runtime: 1 ms (Beats 97.92% submissions) ✓ Memory: 42.52 MB Key Learning: ✓ Practiced digit extraction using modulus and division ✓ Understood how to repeatedly reduce a number to a single digit ✓ Strengthened problem-solving using loops and basic number manipulation Learning one problem every single day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
#Day13 – Advanced Strings & Mutable vs Immutable 🤯 Today was all about Advanced String concepts and understanding Mutable vs Immutable in Java. ✔ Difference between immutable and mutable strings ✔ How concat() creates a new object in Heap ✔ How reference update changes output ✔ Difference between String, StringBuffer, and StringBuilder ✔ Initial capacity (16) and dynamic capacity formula (n * 2 + 2) ✔ Methods like length(), charAt(), toCharArray() ✔ Split vs StringTokenizer (why split is recommended) TAP Academy Harshit T #Java #Strings #StringBuilder #StringBuffer #CoreJava #ProgrammingJourney #Consistency
To view or add a comment, sign in
-
-
✅ 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
-
-
🚀Java practice - Day 87 Completed! 👍 Problem: Sum of Squares of Special Elements Language: Java Today’s problem was about identifying special elements in a 1-indexed array. An element is considered special if its index divides the length of the array (n % i == 0). The task was to calculate the sum of the squares of such elements.✨ #Day87 #Java #LeetCode #Arrays #ProblemSolving #DailyCoding #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
Day 84/365 ✔️ Solved LeetCode 26 – Remove Duplicates from Sorted Array using Java. A classic two-pointer problem that looks simple but really tests how well you handle in-place updates. Key takeaways from today: • Leveraged the two-pointer technique • Modified the array in-place with O(1) extra space • Preserved the relative order of elements • Reinforced how sorted arrays simplify logic Consistency > intensity. One problem a day, building strong fundamentals. On to the next 🚀 #Day84 #365DaysOfCode #LeetCode #Java #DSA #TwoPointers #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
Day 14/100 – LeetCode Challenge 🚀 Problem: #169 Majority Element Difficulty: Easy Language: Java Approach: Sorting + Middle Element Time Complexity: O(n log n) Space Complexity: O(1) 🔍 Key Insight: The majority element appears **more than ⌊n / 2⌋ times** in the array. If we **sort the array**, the majority element must occupy the **middle position** because it appears more than half of the time. Therefore, the element at index **n/2** will always be the majority element. 🧠 Solution Brief: First sorted the array using `Arrays.sort()`. Since the majority element appears more than half of the array length, it will always be positioned at the middle index. Finally returned `nums[nums.length / 2]` as the majority element. 📌 What I Learned: Understanding problem constraints can simplify the solution significantly. Sometimes a simple observation (like majority occupying the middle after sorting) can avoid more complex implementations. #LeetCode #Day14 #100DaysOfCode #Java #DSA #Arrays #ProblemSolving #CodingJourney
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
good