Biweekly Contest 128 – 3/4
Q1: https://leetcode.com/problems/score-of-a-string/ Q2: https://leetcode.com/problems/minimum-rectangles-to-cover-points/ Notes: The y values don’t matter; only the x values matter. Q3: https://leetcode.com/problems/minimum-time-to-visit-disappearing-nodes/description/ Notes: Use Dijkstra’s...
Biweekly Contest 128 – 3/4
Q1: https://leetcode.com/problems/score-of-a-string/ Q2: https://leetcode.com/problems/minimum-rectangles-to-cover-points/ Notes: The y values don’t matter; only the x values matter. Q3: https://leetcode.com/problems/minimum-time-to-visit-disappearing-nodes/description/ Notes: Use Dijkstra’s...
Daily Question – 950. Reveal Cards In Increasing Order
Description: https://leetcode.com/problems/reveal-cards-in-increasing-order/description/?envType=daily-question&envId=2024-04-10 Code: Time Complexity O(n2) Improvement: This approach is genius. https://leetcode.com/problems/reveal-cards-in-increasing-order/solutions/5001220/beats-94-easy-approach-using-deque-with-explanation Deque in Java is a...
Daily Question – 2073. Time Needed to Buy Tickets
Description: https://leetcode.com/problems/time-needed-to-buy-tickets/description/ Code: Time complexity O(n2) Can be simplified to O(n) as we do not need...
Daily Question – 1700. Number of Students Unable to Eat Lunch
Description: https://leetcode.com/problems/number-of-students-unable-to-eat-lunch/description/ Notes: Time Complexity = O(n2), can be simplify to O(n) Code:
Weekly Contest – 392 (3/4)
Contest: https://leetcode.com/contest/weekly-contest-392/
Daily Question – 678. Valid Parenthesis String
Description: https://leetcode.com/problems/valid-parenthesis-string/description/?envType=daily-question&envId=2024-04-07 Approach: My initial approach is quite straightforward: Using stack to save the index of...
Daily Question – 1544. Make The String Great
Description: https://leetcode.com/problems/make-the-string-great/description/?envType=daily-question&envId=2024-04-05 Note: One direct way is to continue iterating the array until no “bad pair”...
Daily Question – 79. Word Search
Description: https://leetcode.com/problems/word-search/description/?envType=daily-question&envId=2024-04-03 Notes: BFS and backtracking. Using a boolean 2-D array to reserve the status of...
Daily Question – 2962. Count Subarrays Where Max Element Appears at Least K Times
Not a hard question, but I need to read the description more carefully.
Daily Question – 2958. Length of Longest Subarray With at Most K Frequency
Description: https://leetcode.com/problems/length-of-longest-subarray-with-at-most-k-frequency/description/ Notes: The first solution that came to my mind was brute force: scanning each...