Mini-Max Sum - HackerRank - Java

1 month ago
4

Learn how to solve the HackerRank problem whose title is Mini-Max Sum, using the Java programming language.

https://www.hackerrank.com/challenges/mini-max-sum

The Data Structures and Algorithms (DSA) lesson uses a running total approach to solving the question using Java.

Traversing the array, you can keep track of the sum so far, in addition to the highest and lowest numbers seen so far.

Then later you can determine the minimum sum by subtracting the highest number and the maximum sum by subtracting the lowest number.

The time complexity for the solution is O(n) and its space complexity is O(1).

DSA problems are sometimes asked during tech job interviews for positions such as Software Engineer, so you can use the challenge to practice that skill.

Loading comments...