Day 93 of #100DaysofCoding 😊

View profile for Suresh Chelani

Former Intern @IITRoorkee | Knight (Top 2.8%) on LeetCode | Full-Stack Developer

Day 93 of #100DaysofCoding 😊 LeetCode POTD: (Done ✅) 1) Combination Sum II Approach1: Using Backtracking: First, sort the array to handle duplicates easily. Then use a recursive function to explore all possible combinations. Include the current element if it doesn’t exceed the target, and then backtrack by removing it. To avoid duplicate combinations, skip over consecutive duplicate elements after considering one. Finally, if the target reaches zero, add the current combination to the result list. This approach ensures that you find all unique combinations that sum up to the target. solution: [https://lnkd.in/gP5H3VcP] Approach2: Using DP First, sort the array to handle duplicates easily. Then use a recursive approach to explore all valid combinations by including or excluding each element. Store the results in a memoization table to avoid recalculating combinations for the same target. Finally, return the stored results to quickly access all unique combinations that sum up to the target. solution: [https://lnkd.in/gw6HBKZs] GeeksforGeeks POTD: (Done ✅) 2) Square root of a number Approach1: The first way using inbuild function sqrt(). Approach2: The Second one is that, by using the binary search. Intuition: Apply binary search within the range [0,n] to determine the  perfect square root. For each midpoint mid, check if mid×mid equals n. If it does, then mid is the perfect square root, and you can return it. If mid×mid is greater than n, reduce the search range by setting e=mid−1. If mid×mid is less than n, update the answer to mid and reduce the search range by setting s=mid+1. Continue this process until the search range is exhausted, and return the last stored value as the floor of the square root. solution: [https://lnkd.in/gn272NK4] 💻#100DaysOfCode #LEETCODE #POTD #LeetCode #Coding🚀

  • No alternative text description for this image

Congratulations, Suresh Chelani! Your incredible progress is inspiring! Keep up the fantastic work, and know that we're here, cheering you on every step of the way! 🎉🌟

See more comments

To view or add a comment, sign in

Explore topics