Biweekly-66 (27th Nov, 2021)
-
2085. Count Common Words With One Occurrence
Hint 1
Use hashmap (Counter) -
2086. Minimum Number of Buckets Required to Collect Rainwater from Houses"
Hint 1
First put the bucket at best place and the remove those covering home.Hint 2
Answer is (best bucket cnt + remaining house).Hint 3
Corner case: check for each house is coverable -
2087. Minimum Cost Homecoming of a Robot in a Grid
Hint
djikstra will fail. why ?Hint
Too many cells to cover (10**10). Think of something elseHint
To reach home, which path you need to take ? (cost is non-negative)Hint
To reach home, number of rows and number of cols changes are fixed. -
2088. Count Fertile Pyramids in a Land
Hint
Deconstruct pyramid into smaller part and then think to calculate how many pyramids are thereHint
we can calculate left and right perpendiculars and then construct pyramids from themHint
calculate for normal and flipped version of grid
Weekly-269 (28th Nov, 2021)
- 2089. Find Target Indices After Sorting Array
Hint
Implementation - 2090. K Radius Subarray Averages
Hint
Prefix sum - 2091. Removing Minimum and Maximum From Array
Hint
Greedy cases to minimize number of removeHint
min(r+1, n-l, l+1+(n-r)). here l and r are index of max and min elements (l < r). - 2092. Find All People With Secret
Hint
sort by time and try to share secretHint
at current timestamp, find connected components and color all nodes if one of them have seen secret