If the client is using functionality from your code it should be exposed to interface i.e. how to call this functionality with what parameters. It will provide an abstraction to the client and we can change the implementation anytime without impacting the caller.
There is n parking slots and n-1 car already parked. Lets say car parked with initial arrangement and we want to make the car to be parked to some other arrangement. Lets say n = 5, inital = free, 3, 4, 1, 2 desired = 1, free, 2, 4 ,3 Give an algorithm with minimum steps needed to get desired arrangement. Told by one of my friend and after a lot of search i really got a nice solution. I will post solution in comment part
Comments
Post a Comment