Day #12
Solved all the 3 questions for Strivers SDE sheet challenge.
1. Find mid, reverse the second part and traverse.
2. Go till slow!=fast, and once equal, start slow from head, meeting point will be the starting point.
3. Just do for 2 Nodes, and recursively for all.
#SDESheetChallenge @striver_79@striver_79
Day #11
Solved all the questions of the Striver's SDE Sheet
1. Reset the iterator when reached the end of the list, on both the lists, when they become equal, that's the intersecting point.
2. Using slow and fast pointer, and when fast->next ==slow is true, that means a loop is present.
3. Divide in k groups, you would need the first and last of each group, plus the last of previous group to link both of them.
#SDESheetChallenge @striver_79@takeUforward_
Day #10
Solved all the 3 questions for the Striver's SDE Sheet Challenge.
1. Occupy the position one less than the node to be removed and remove it.
2. Each element = sum of first node value + sum of second node value + carry, initially carry would be 0, and atlast, if carry remains, make new node and append.
3. One liner: *node = *node->next; if not, then just do
node->val = node->next->val; and remove the last node, that would do the work.
#SDESheetChallenge @striver_79@takeUforward_
Day #9
Completed all the 3 questions for today's Striver SDE Sheet Challenge.
1. Using 3 pointer approach to reverse.
2. Using slow and fast pointer based approach.
3. Using dummy node.
#SDESheetChallenge@striver_79@takeUforward_
Because microservice is not the answer to every solution, we will have to look at the tradeoffโs before switching from monolith to microservice.
Microservices, as fancy as it sounds, comes with a lot of tradeoffโs the biggest one being the complexities that it brings along, other reasons include high costs, difficulty to manage, communication issues between services and lot more.
So every buzz word is not the solution to every problem.
Day #7
Completed all the 3 questions for SDE Sheet Challenge.
1. Optimal using a hashmap, target - currentNum;
2. Used similar approach as 3 sum, important part is moving the last and second last pointer based on the target value.
3. Iterating only those elements which are starting points.
#SDESheetChallenge @takeUforward_@striver_79
Day #8
Solved all the 3 questions for the Striver's SDE Sheet Challenge.
1. Store the sum along with the index in a map at each index, and then while iterating, just check where the diff, occurred, i.e a+b=target, then a = target-b, so now, all the way, find a.
2. Solved using the equation,{ x^a=b }=>{ (x^a)^a=b^a }=> {x =b^a}, now we have to find this x, similar as above.
3. Optimal using the 2 pointer dynamic sliding window.
#SDESheetChallenge @striver_79@takeUforward_
Todayโs question on takeUForward!
In a Binary Search Tree (BST), every node follows the property that all values in its left subtree are smaller than the nodeโs value, and all values in its right subtree are greater than the nodeโs value.
Inorder traversal visits nodes in the order Left โ Root โ Right. Therefore, it first visits all smaller elements (left subtree), then the current node, and finally all larger elements (right subtree).
Since this property holds recursively for every node in the BST, an inorder traversal of a BST produces the elements in sorted (ascending) order.
Keep learning keep growing ! ๐ช๐ป
Getting noticed by the takeUforward team feels rewarding. A good sign that consistent learning, dedication, and commitment never go unnoticed. ๐ฅ๐๐ป
@takeUforward_@striver_79