Day 12 of #100DaysOfLeetCode 💻✅ Solved #326. Power of Three problem in Java. Approach: • Checked if the number is less than or equal to zero (not a power of three) • Continuously divided the number by 3 while it was divisible • Verified whether the final value becomes 1 • Avoided recursion and used iteration for better efficiency Performance: ✓ Runtime: 8 ms (Beats 86.60% submissions) ✓ Memory: 46.35 MB Key Learning: ✓ Strengthened understanding of number divisibility logic ✓ Learned efficient validation of power-based numbers ✓ Improved problem-solving using iterative reduction Learning one problem every day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
Solved LeetCode #326 Power of Three in Java
More Relevant Posts
-
Day 27 of #100DaysOfLeetCode 💻✅ Solved #83. Remove Duplicates from Sorted List on LeetCode using Java. Approach: • Utilized the fact that the linked list is already sorted • Traversed the list using a single pointer • Compared current node value with next node value • If duplicate found, skipped the next node by updating links • Continued traversal until reaching the end of the list Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 45.30 MB (Beats 85.70% submissions) Key Learning: ✓ Understood how sorting simplifies duplicate removal logic ✓ Strengthened pointer manipulation skills in linked lists ✓ Learned efficient in-place modification without extra space Learning one problem every single day 🚀 #Java #LeetCode #DSA #LinkedList #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🪨📺 Even early humans knew the importance of good logic! From stone caves to Java code — the idea is timeless. This logic demonstrates an efficient way to compute the sum of (n-1) elements by: Calculating the total sum once Subtracting one element at a time instead of using nested loops Simple. Clean. Optimized. Because whether it’s early humans discovering fire 🔥 or developers optimizing code ⚙️ — good logic always survives the ages. #Java #ProgrammingLogic #DSA #ProblemSolving #CodingLife #LearningByDoing #TechHumor
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
-
-
Day 38 of #100DaysOfLeetCode 💻✅ Solved #222. Count Complete Tree Nodes problem in Java. Approach: • Used recursion to traverse the binary tree • Counted the current node and recursively counted nodes in left and right subtrees • Added the counts to get the total number of nodes • Returned 0 when the node is null to stop recursion Performance: ✓ Runtime: 0 ms (Beats 100% submissions) ✓ Memory: 44 MB Key Learning: ✓ Practiced recursion with binary trees ✓ Understood how tree traversal helps count nodes in a tree ✓ Improved recursive thinking while solving tree problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 29 of #100DaysOfLeetCode 💻✅ Solved #22. Generate Parentheses on LeetCode using Java. Approach: • Used Backtracking to generate all valid combinations • Added "(" only if open brackets were available • Added ")" only when close brackets were greater than open • Ensured at every step that the parentheses remain balanced • Stopped recursion when both open and close counts reached zero Performance: ✓ Runtime: 3 ms (Beats 16.29% submissions) ✓ Memory: 45.18 MB (Beats 13.87% submissions) Key Learning: ✓ Strengthened understanding of Backtracking technique ✓ Learned how to maintain constraints during recursion ✓ Improved ability to build combinations using decision trees Learning one problem every single day 🚀 #Java #LeetCode #DSA #Backtracking #Recursion #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 14/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 3162. Find the Number of Good Pairs I Used a nested loop (brute-force) approach to check divisibility condition nums1[i] % (nums2[j] * k) == 0 for all possible pairs. ⏱️ Time Complexity: O(n × m) 📦 Space Complexity: O(1) Strengthening fundamentals by mastering basic logic and edge cases before jumping into optimizations. 💪 Consistency + clarity = long-term growth 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 17 – Largest Number At Least Twice of Others Solved this array-based problem by identifying the largest element and verifying whether it is at least twice every other number. Key Learnings: Efficiently finding the maximum element and its index Applying conditional checks carefully Strengthening array traversal fundamentals #Java #LeetCode #DSA #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 4 of Strengthening My DSA Fundamentals Today I learned how to reverse an array in Java using the Two Pointer technique. Instead of creating a new array, I implemented an in-place reversal using: • start = 0 • end = array.length - 1 • Swapping elements using a temporary variable • Moving start++ forward and end-- backward • Looping until start < end This approach is: ✅ Time Efficient – O(n) ✅ Space Efficient – O(1) ✅ Widely used in interviews Understanding the logic behind pointer movement made the concept much clearer. Small steps daily. Strong foundations always. 💪 #Java #DSA #TwoPointers #CodingJourney #Consistency #LearningInPublic
To view or add a comment, sign in
-
-
Day: 32/365 📌 LeetCode POTD: Minimum Deletions to make string balanced Medium Key takeaways/Learnings from this problem: 1. Using a stack makes the imbalance obvious—you directly see where a b is messing up the order before an a. 2. Big takeaway: sometimes simulating the process cleanly is easier than mathy DP, and still gives an optimal result. #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
To view or add a comment, sign in
-
Day 26 of #100DaysOfLeetCode 💻✅ Solved #203. Remove Linked List Elements on LeetCode using Java. Approach: • Handled edge cases by removing matching nodes from the beginning of the list • Traversed the linked list using a pointer • Checked the next node’s value instead of the current node • If value matched, updated links to skip the node • Maintained in-place modification without using extra data structures Performance: ✓ Runtime: 1 ms (Beats 95.94% submissions) ✓ Memory: 47.62 MB Key Learning: ✓ Improved understanding of linked list pointer manipulation ✓ Learned how to handle head node edge cases carefully ✓ Strengthened in-place deletion logic in singly linked lists Learning one problem every single day 🚀 #Java #LeetCode #DSA #LinkedList #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