Answered step by step
Verified Expert Solution
Link Copied!

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, P.
The second line tells how many positions have
garbage, N
The third line has an array of 0 s and is, where 1
means there is garbage and 0 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 1-hased
Input
. frst lne of the noutconto ins P, represento
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions