Ebay | Interview Experience MTS | Bangalore
Anonymous User
3834

Q1: Given an array, move all odd numbers to the front and even numbers to the back with preservered order of even and odd numbers.

But with some hard constraints:

In-place (no extra memory)
O(n) time complexity

Couldn't solve it in O(n) with the given constraints, it seems not doable in O(n) without any extra memory and keeping the order. Can anybody try?

Q2: Find the maximum subarray sum. It can have negative numbers as well.
Solved it using Kadane's.

Comments (7)