Ensure that you are logged in and have the required permissions to access the test.
Since exams are over, happy days have started!
Well, we should maximize our happiness to get the most out of it.
Each item has a happiness level of either 1,2,3 or 4. Items need to be picked in groups of 3, and happiness of this group of items A, B, C is defined as A*B*C, maximize and return the total happiness that you can get from the given set of items.
N - Total number of items,
An array of size N, Arr[i] denoting the value of the ith item.
3<=N<=105
Total maximum happiness that you can achieve.
The best way to pick group 1 is 3 4 & 3, to obtain 3*3*4= 36, remaining 2 can't be picked as items can only be picked in groups of 3