I JustWriteTheCode of the solution to the "Jesse and Cookies" problem present on HackerRank (1 Week Preparation Kit - Day 6).
Programming Language: C++.
Problem:
Jesse loves cookies and wants the sweetness of some cookies to be greater than value k. To do this, two cookies with the least sweetness are repeatedly mixed. This creates a special combined cookie with:
sweetness = 1 x (Least sweet cookie) + 2 x (2nd least sweet cookie).
This occurs until all the cookies have a sweetness greater than or equal to k.
Given the sweetness of a number of cookies, determine the minimum number of operations required. If it is not possible, return -1.