Continuing the #SDESheetChallenge
Day 46
Solved today:
- Clone graph
- DFS traversal
- BFS traversal
- Cycle detection in undirected graph using BFS
- Cycle detection in undirected graph using DFS
Speeding up.... need to cover many concepts before the peak of internship season!!
Day 44: #SDESheetChallenge@striver_79@takeUforward_
Solved:
- Flatten Tree to DLL
- Median of data stream
- kth largest in data stream
Solved 1 using a very straightforward approach (using an extra vector). Not that optimal but very simple. Working on its optimal solution.
Day 43: #SDESheetChallenge@takeUforward_@striver_79
Solved:
- Two sum in BST
- Serialize and Deserialize in BST
- Maximum sum BST
- BST Iterator
Good implementation problems today.
Day 42: #SDESheetChallenge@takeUforward_@striver_79
Solved:
-Floor in BST
-Ceil in BST
-kth smallest in BST
-kth largest in BST
1,2 were easy, just compare the current value with given and move left/right accordingly. Similarly, 3,4 were just inorder, rev. inorder with counter
Day 40 of #SDESheetChallenge@takeUforward_@striver_79
Solved today:
- Populating next pointers: Straightforward bfs implementation
- Search in BST: Easy use of property of BST
- Construct BST: Another easy one, divide and conquer type.
Day 39 of #SDESheetChallenge@striver_79@takeUforward_
Solved Today:
- Children sum: Easy problem, direct DFS
- Symmetric tree: Did using BFS+ Palindrome check
- Flatten binary tree: Idea was simple, implementation took time. Good problem
Day 38 of #SDESheetChallenge@striver_79@takeUforward_
Solved today:
- Maximum path sum: Classic DP on trees implementation
- Construct from inorder & preorder
- Construct from inorder & postorder
2nd and 3rd were very standard problems, although new for me, were fun to solve
Day 37 of #SDESheetChallenge@striver_79@takeUforward_
Solved today:
- ZigZag Traversal
- Boundary Traversal
- Same Tree
- Lowest Common Ancestor
First three were very intuitive, the key idea to the 4th one also struck quickly but felt its implementation to be a little tricky.
Day 36 of #SDESheetChallenge@striver_79@takeUforward_
Solved today:
- Level order traversal
- Maximum depth of binary tree
- Balanced Binary tree
- Diameter of binary tree
Except the first, all others were similar, variants of each other. Fundamental problems today.
Day 35 of #SDESheetChallenge@striver_79@takeUforward_
Solved today:
-Vertical order traversal
- Maximum width of a tree
- Root to leaf paths
- Inorder, preorder, postorder traversals using single stack
Dat 34 of #SDESheetChallenge@striver_79@takeUforward_
Solved today:
- Morris Postorder: Same idea as inorder version- internal threading
- Top view
- Bottom view
- Right view
These three had a similar idea. I first did DFS in bottom view, took too much debugging and lots of WAs
Day 33 of #SDESheetChallenge@striver_79@takeUforward_
- Inorder traversal
- Preorder traversal
- Postorder traversal
- Morris inorder traversal
4th was something new for me. I figured out there was something to do with threading, but couldn't figure out completely.
Day 32 of #SDESheetChallenge@takeUforward_@striver_79
Solved today:
- Valid anagram
- Count and say
- Compare version numbers
Today's problems had easy to figure out approaches. However, 2 and 3 served as a good implementation problems.
Day 31: #SDESheetChallenge@takeUforward_@striver_79
Solved today:
- Needle in haystack: Easy, direct search problem
- Min. insertions to make palindrome: Figured out the approach quickly, had to revise LCS to implement
- Z Algorithm: An awesome problem, learnt amazing things!
Day 30 of #SDESheetChallenge@takeUforward_@striver_79
Solved today:
- String to integer
- Longest common prefix
- Repeated string match
1 and 2 were pretty easy. 3 took a lot of WAs, lots of learning and a good lesson.
Can't believe its day 30 already!!
Day 29 of #SDESheetChallenge@takeUforward_@striver_79
Solved today:
- Reverse words in a string
- Longest palindromic substring
- Roman to integer
Very standard set of problems today, finished quickly.