if stack is empty , you should return some kind of error or throw some exceptions imo.
i dont know what those are , but assuming they do the work they are supposed to , AND its an in-place operation , you are returning a reversed version of stack , but its not a copy of the original stack , because the stack itself has been reversed. here is something you can do :
make FancyStack iterable
in your else() condition , have a for() loop that takes in each member of FancyStack() and put that in a new copy.
apply revertStack.push(pop()) to this newly made copy , and return it.
Pyler: it seems to me like you have three or four threads about this particular question. it's pretty hard to follow what has already been suggested, if it's spread over several threads. could you please pick one thread, copy all answers to that, and put the others on 'solved'?
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...