Answered step by step
Verified Expert Solution
Question
1 Approved Answer
RubbleRover You have built a small robot named RubbleRover, which collects trash and has a radar. You want to use it for recycling. Here is
RubbleRover
You have built a small robot named RubbleRover,
which collects trash and has a radar. You want to use
it for recycling. Here is what you need to know.
There are garbage blocks lined up in a row, with
equal distance between them.
RubbleRover can tell if there is a garbage block
at a certain distance from it If it finds a block, it
moves to that block and collects it
If RubbleRover cannot tell if the garbage is on its
left or right, it will not go there to save energy
and work efficiently.
RubbleRover will keep checking further if it is
unsure about the garbage's location.
You are given the following:
The first line tells where RubbleRover starts,
The second line tells how many positions have
garbage,
The third line has an array of s and is where
means there is garbage and means there is no
garbage
Your ob is to figure out how mary garbage blocks
RubbleRover will recycle while being most efficient.
Note: Every position is hased
Input
frst lne of the noutconto ins represento
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started