This was a coding problem I was given on HackerRank for an application coding challenge. I ran out of time during the test so I spent a few extra minutes to finish it on my own.
The function was supposed to take an array of integers (in the c++ implementation they used vectors), and return an array that's elements alternated between the max and min values. so lets say we input a vector with values 2,5,-12,10,-7,-2,8,20 the function would return a vector with values 20, -12, 10, -7, 8, -2, 5, 2.
I felt pretty stupid that I didn't finish it in time since it wasn't that difficult of a problem. I spent too much time trying to look it up instead of just trying to solve it by myself.