Back to Browse

HackerRank C++ Solution – Jesse and Cookies

958 views
Sep 22, 2022
4:32

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.

Download

1 formats

Video Formats

360pmp45.6 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

HackerRank C++ Solution – Jesse and Cookies | NatokHD