HashMap

Apr
13
2024
0

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...

Mar
28
2024
0

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...

Mar
14
2024
2

Daily Question – 930. Binary Subarrays With Sum

Description: https://leetcode.com/problems/binary-subarrays-with-sum/description/ Notes: My initial approach was a brute force method, which had a time complexity...

Mar
13
2024
0

Daily Question – 30. Substring with Concatenation of All Words

My initial approach is quite straightforward: I use two hashmaps. The first hashmap is used to store the required words, and the second one is used to check whether the word counts in each substring are the same.

Mar
11
2024
0

Daily Question – 791. Custom Sort String

I utilized a hashmap to count the number of characters in a specific order. This map stores the characters from the ‘order’ string as keys and their corresponding counts as values. The reason for choosing a LinkedHashMap is to preserve the order in which the characters were inserted.