raginieharris, IIT Exam at Altera
I am Ragini, and I have lived in Washington for 2 years. My current job is Web Designer in Corinthian ...
arlenekraft8, How to book a seat on Southwest airlines flight at Absolute Softech Ltd
I am a coding specialist from MD,USA.I’m indifferent to most items on the planet.Participated in creating ...
louisefbray, Integration Software Engineer at Ask.com
Hey! My name is Louise and I am a computer hardware retailer and wholesaler.I also provide services online. My ...
My solution is to iterate over the list once. First make a temp copy of the list and then iterate over the list. While iterating, if the number is negative then pop it out of the temp list and then add it back to the end of temp list. For the positive numbers, do the opposite which is to pop the number out from the temp list and then add it to the front of the temp list, which also a reverse order for the positive numbers. Keep track of count for positive numbers, so you can slice the final temp list into positive and negative lists. Now, you just need to reverse the positive list and append the two lists into a single list as a return value.
After iterating over the original list
After slicing by positive-integer count
After reversing positive list
- Zorigt.Baz August 25, 2016