Debounce (ES6)

Sometimes, we would like to wait a certain minimum time period before successive method calls. For example in events like onscroll(), onresize(), this can go a long way in terms of optimizing the page performance as a whole.

The wrapping the methods using a Debounce method is a simple way to achieve the desired result.


Minimum Window Substring – Java

The brute force method would be calculate all the substrings, which would be inefficient.

Runtime Complexity O(m + n)

Space Complexity O(m+n)

UTF-8 Validation – Java

Hint UTF-8 ranges between 1 to 4 bytes (8-bits).

Runtime: O(n)



K Empty Slots – Java

Time O(nlogn)
Space O(n)

Top K Frequent Elements – Java

Runtime O(nlogn)

Continue reading “Top K Frequent Elements – Java”