Samsung Interview Question for SDE1s
- 0of 0 votes
There are N cars parked in a row in a parking lot of the newly constructed club. as it is demonstrated in the picture below.- shivanandtripathi02 October 27, 2019 in India
There is a gasoline and diesel fueling station installed.at the left and right side of the park.
An automatic fueling robot carries the fuel from station and fill up the parked car with fuel.
The cars are divided into 2 types depending on whether it is a gasoline or diesel car.
1 is denoted as gasoline cars and 2 is denoted as diesel cars.
The automatic robot will be used to provide a cost free fueling service which is filling up
all cars with 1 litre of each corresponding fuel.
The robot will move in between the 2 fuelling stations as below :
1) The robot carries 2 litre of gasoline at the gasoline station and starts moving from there.
2) The robot can fill up the cars of the same type of gas it carries 1 litre each.
3) The robot can go back to the fuelling station at any time, Independent from the current amount of fuel it carries.
4) When the robot arrives at the fuelling station, it gets 2 litre of supply of the corresponding fuel.(If the robot has some remaining fuel it will be discarded).
the picture is not there. so, i will explain how the arrary must look like. suppose the arrary is arr od
size x. then at index = 0, there is gas station and at index = x - 1 there is dielsel station. Remaining all indexes are filled with vehicle type. 1 represents gas type and 2 represents diesel type.
| Report Duplicate | Flag | PURGE
Samsung SDE1 .Net/C#
Interview Type: Written Test