Maximize Memory Points (India Intern :)
The course has n chapters, each chapter has memory[i] memory points,
which a student gains or loses while reading that chapter.
The course has a requirement: in order to study the ith chapter, the student must
revisit all the previous chapters. A student gains memory[0] + memory[1] + ... + memory[i]
memory points for reading the ith chapter. The total memory points is the sum of memory
points gained while reading each chapter.
Students can read the chapters in any order, and want to maximize their total memory points. Find the maximum total memory points a student can score ensuring that all the chapters are read.
1Example 1
2Example 2
Constraints
Limits and guarantees your solution can rely on.
π