We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Candles Counting
Candles Counting
Sort by
recency
|
31 Discussions
|
Please Login in order to post a comment
Alice has 'a' candles. Each candle burns for one hour and then goes out. Alice, being a smart person, can make a new candle from 'b' went out candles. This new candle can be used like any other candle. Given 'a' and 'b', find the maximum number of hours Alice can light the candles. Assume that the value of ‘b’ is strictly greater than 1. Employee portal system
similar to the longest increasing subsequence where hackerrank gives u a vid to the solution, except instead of using lower_bound to do a log time search at each iteration, fenwick trees are used to keep track of the sum
O(N * log(max height) * 2^K), pass all test. good thing number of colors is 7 at max, or else this algo will blow for too many colors. no idea how to reduce the 2^K factor to K
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Candles Counting Problem Solution
Here is Candles Counting problem solution - https://programs.programmingoneonone.com/2021/07/hackerrank-candles-counting-problem-solution.html
Alice has 'a' candles. Each candle burns for one hour and then goes out. Alice, being a smart person, can make a new candle from 'b' went out candles. This new candle can be used like any other candle. Given 'a' and 'b', find the maximum number of hours Alice can light the candles. Assume that the value of ‘b’ is strictly greater than 1.