Hash Table
April 26, 2024
1 min
This technique can be used to solve problems have the following format:
Return the length of the longest contiguous subarray [u,v] of array A that subarray [u,v] meets the requirement X. X is a requirement such that: if [u,v] doesn’t meet X, then [u,v’] doesn’t meet X too (v’ > v).
Example
So the general algorithm will be:
Run time: O(n)
insert(value): insert a value into the heap
pop(): get the min value in the min heap, and remove it from the heap
top(): get the min value in the min heap
runtime (n is the number of node in heap.):
Quick Links
Legal Stuff
Social Media