u/faux-maverick

An easy greedy chain extension problem.

there is an array of size n of heights at which lie balloons and you throw a dart at the first balloon at height h then after it strikes the first balloon then it's height decreases by one and and starts travelling height h-1 until it strikes a new balloon. you have to count the min number of darts you need to throw so that all balloons burst.

i.e.
input
n = 5
2 1 5 4 3
output
2

input
5
4 5 2 2 4
output
4

ps : sorry for bad english not my main language

reddit.com
u/faux-maverick — 12 days ago

A DSA problem for you all.

Given an unsorted array of n integers you have to find the no. of bubble sort adjacent swaps you will need to perform to sort this if it was sorted by bubble sort. Find in nlog(n) time complexity.

(sorting ka proper use pehli baar mere liye to).

reddit.com
u/faux-maverick — 17 days ago