Given an array having positive and negative numbers. Rearrange the array in such a way that positive and negative numbers are then alternate
Anonymous
There is a society which has 8 parking slots and there are 7 cars. Each car is supposed to be parked in some fixed position and one slot is needed to be left. Example – Let { A ,” “, D, E, B, F, G, C} be the perfect arrangement. But society people never follow the rule and park in any position. Your work is to design a strategy which arranges the cars in perfect arrangement at the end of the day having minimum number of swaps. I was able to solve only this one question in this round. I used to strategy that : 1. I’ll first find the empty slot and will check if there is some car should be placed in that place properly and will swap the car. 2. In case the empty slot is at correct position then I’ll find an improperly placed car and place it at empty slot and then will continue with step 1 iteratively till I get the perfect arrangement.
Check out your Company Bowl for anonymous work chats.