Blogs

Last Stone Weight
Last Stone Weight

Link to the question: LeetCode/Last-stone-weight In this problem, you are given an array of integers representing the weights of stones. The goal is to simulate a game where, at each turn, the two heaviest stones are selected and either both are destroyed (if they have the same weight) or the …

Kth Largest Element In a Stream
Kth Largest Element In a …

This is a simple software design problem in LeetCode. So according to problem we have to create a datastruccture which will return the kth_largest element every time we add element in this datastructure. Intutive Approach This soltuion can be pretty intutive just insert the new element and sort the …