Day 60 of #100DaysOfLeetCode 💻✅ Solved #389. Find the Difference problem in Java. Approach: • Initialized a variable to store the sum • Subtracted ASCII values of all characters in string s • Added ASCII values of all characters in string t • The remaining value represents the extra character • Converted the result back to character and returned it Performance: ✓ Runtime: 3 ms (Beats 38.82% submissions) ✓ Memory: 43.34 MB (Beats 30.69% submissions) Key Learning: ✓ Learned a clever use of ASCII values for problem solving ✓ Practiced using math-based approach instead of extra data structures ✓ Improved understanding of string manipulation techniques Learning one problem every single day 🚀 #Java #LeetCode #DSA #Strings #Math #ProblemSolving #CodingJourney #100DaysOfCode
Java LeetCode 389: Find Difference with ASCII Values
More Relevant Posts
-
Day 73 of #100DaysOfLeetCode 💻✅ Solved #389. Find the Difference problem in Java. Approach: • Initialized a variable to store the sum • Added ASCII values of all characters in string t • Subtracted ASCII values of all characters in string s • The remaining value represents the extra character • Converted the result back to character and returned it Performance: ✓ Runtime: 1 ms (Beats 99.89% submissions) 🚀 ✓ Memory: 42.77 MB (Beats 97.03% submissions) Key Learning: ✓ Practiced optimized string traversal using enhanced for-loop ✓ Reinforced understanding of ASCII-based solutions ✓ Learned how mathematical approaches can simplify problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #Strings #Math #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 61 of #100DaysOfLeetCode 💻✅ Solved #541. Reverse String II problem in Java. Approach: • Converted the string into a character array • Traversed the array in steps of 2k • For every segment, reversed the first k characters • Used two-pointer technique to perform in-place reversal • Math.min() to handle cases where remaining characters are less than k Performance: ✓ Runtime: 2 ms (Beats 16.04% submissions) ✓ Memory: 44.80 MB (Beats 73.53% submissions) Key Learning: ✓ Practiced handling strings with fixed pattern intervals ✓ Improved control over indexing and boundaries ✓ Strengthened in-place modification techniques Learning one problem every single day 🚀 #Java #LeetCode #DSA #Strings #TwoPointers #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
#CodeEveryday — My DSA Journey | Day 3 🧩 Problem Solved: Combination Sum III (LeetCode #216) 💭 What I Learned: Used backtracking to find all possible combinations of k numbers (1–9) that sum up to a target n. At each step: ✔️ Decided whether to include the current number ✔️ Reduced both the remaining sum (n) and count (k) ✔️ Ensured each number is used only once by moving to the previous index Applied constraints effectively to prune recursion when: Remaining sum becomes negative Required count becomes invalid This improved my understanding of handling multiple constraints (sum + size) simultaneously in recursion. ⏱ Time Complexity: O(C(9,k) 🧠 Space Complexity: O(k) (recursion depth) ⚡ Key Takeaways: ✔️ Backtracking with multiple constraints requires careful pruning ✔️ Fixed input size can significantly reduce complexity ✔️ Choosing + skipping pattern helps explore all valid combinations 💻 Language Used: Java ☕ 📘 Concepts: Backtracking · Recursion · Combinations · Constraint Handling #CodeEveryday #DSA #LeetCode #Java #Backtracking #ProblemSolving #Algorithms #CodingJourney #Consistency 🚀
To view or add a comment, sign in
-
-
🚀 Day 58 / 100 – LeetCode Challenge ✅ Problem Solved: Binary Tree Postorder Traversal 📊 Difficulty: Easy 💻 Language: Java Today’s problem focused on understanding tree traversal, specifically Postorder Traversal (Left → Right → Root). 🔍 Key Learnings: Mastered recursive approach for tree traversal Understood how DFS (Depth First Search) works in binary trees Strengthened problem-solving with clean and efficient logic ⚡ Performance: Runtime: 0 ms (Beats 100%) 🔥 Memory: 42.96 MB 💡 Approach: Used a simple recursive helper function: Traverse left subtree Traverse right subtree Add root node value This problem may be easy, but it builds a strong foundation for advanced tree problems 💪 📈 Consistency is key — 58 days down, 42 more to go! #LeetCode #100DaysOfCode #Java #DataStructures #CodingJourney #BinaryTree #DSA #Learning #Consistency
To view or add a comment, sign in
-
-
📘 DSA Journey — Day 33 Today’s focus: Binary Search for next greater element. Problem solved: • Find Smallest Letter Greater Than Target (LeetCode 744) Concepts used: • Binary Search • Upper bound concept • Circular handling Key takeaway: The goal is to find the smallest character strictly greater than a given target in a sorted array. This is a classic upper bound problem: We use binary search to find the first element greater than the target. During search: • If letters[mid] > target, store it as a possible answer and move left • Else move right An important edge case: If no character is greater than the target, we return the first element (circular behavior). Continuing to strengthen binary search patterns and problem-solving consistency. #DSA #Java #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
Day 74 of #100DaysOfLeetCode 💻✅ Solved #162. Find Peak Element problem in Java. Approach: • Used Binary Search technique to efficiently find the peak element • Set two pointers, left at start and right at end of the array • Calculated mid index using safe mid formula • Compared nums[mid] with nums[mid + 1] to determine direction • If mid element is smaller, moved search space to right half • Otherwise, moved search space to left half including mid • Continued until left and right pointers converged • Final position (left == right) represents the peak index Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) 🚀 ✓ Memory: 44.32 MB (Beats 25.49% submissions) Key Learning: ✓ Strengthened understanding of Binary Search on unsorted arrays ✓ Learned how to apply divide-and-conquer beyond traditional searching ✓ Improved intuition for peak finding using neighbor comparison ✓ Practiced optimizing search space instead of linear scanning Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinarySearch #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
💻 Interesting Java problem: Find the closest target in a circular array Given a words[] array, a target, and a startIndex, the task is to find the shortest circular distance to the target. Leetcode Problem :https://lnkd.in/g3RbdChE Core idea: For every matching target: find direct distance → Math.abs(i - startIndex) find circular distance → n - dist take the minimum. This is a neat example of how circular arrays require us to think beyond normal linear traversal. Small twist, smart logic. 🚀 #Java #Algorithms #DSA #CodingInterview #ProblemSolving #LeetCode
To view or add a comment, sign in
-
-
🚀 Day 2/75 – LeetCode Challenge Today I solved the problem “Greatest Common Divisor of Strings” 💡 In this problem, we are given two strings and need to find the largest string that can divide both of them (i.e., by repeating itself). 🔍 Key Learnings: Pattern recognition is very important The condition (str1 + str2 == str2 + str1) simplifies the problem Mathematical concepts like GCD can be applied to strings 🤯 🧠 Approach: First, check if both strings are compatible Then, find the GCD of their lengths Finally, take the substring of that length as the answer 💻 Language: Java Staying consistent and learning every day 🔥 #LeetCode #CodingJourney #Java #DSA #100DaysOfCode #LearningInPublic
To view or add a comment, sign in
-
-
Day 76 of #100DaysOfLeetCode 💻✅ Solved #33. Search in Rotated Sorted Array problem in Java. Approach: • Applied Binary Search on rotated array • Checked which half is sorted at each step • Reduced search space based on target position Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) 🚀 ✓ Memory: 43.80 MB (Beats 70.96% submissions) Key Learning: ✓ Mastered searching in rotated sorted arrays ✓ Improved Binary Search decision-making ✓ Learned efficient handling of edge cases Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinarySearch #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 77 of #100DaysOfLeetCode 💻✅ Solved #153. Find Minimum in Rotated Sorted Array problem in Java. Approach: • Used Binary Search to find minimum element • Compared mid with right to decide direction • Reduced search space until pointers converged Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) 🚀 ✓ Memory: 43.62 MB (Beats 78.18% submissions) Key Learning: ✓ Strengthened Binary Search on rotated arrays ✓ Learned how to identify unsorted portion efficiently ✓ Improved optimization over linear search Learning one problem every single day 🚀 #Java #LeetCode #DSA #BinarySearch #Arrays #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