Start at top left corner.Move right one collecting a passenger. The goal is to collect as many passengers as possible so that the driver can maximize his earnings.If there is no valid path between (0,0) and (n-1,n-1),then no passenger can be picked.When passing through a path cell containing a passenger,the passenger is picked up.once the rider is picked up the cell becomes an empty path cell.After reaching (n-1,n-1) the taxi driver travels back to (0,0) by travelling left or up through valid path cells.The Taxi driver starts at (0,0) and the railway station is at (n-1,n-1).Movement towards the railway station is right or down,through valid path cells.The rules of motion of taxi are as follows: A value equal to -1 represents an obstruction.A value equal to 1 represents a passenger.A value greater than or equal to zero represents a path.The Matrix is filled with cells,and each cell will have an initial value as follows: Problem Statement -: A taxi can take multiple passengers to the railway station at the same time.On the way back to the starting point,the taxi driver may pick up additional passengers for his next trip to the airport.A map of passenger location has been created,represented as a square matrix.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |