Since the robot should pick the solution

Assignment Help Computer Engineering
Reference no: EM133369670

Question: Suppose a robot is trying to cross a river. The system provides two suggestion lists like the following:

Given:

list1 = ["swim", "boat", "via bridge A", "airplane"]
list2 = ["via bridge B", "swim", "give up"]
The robot will pick "swim"

[Explain] The robot will pick the solution based on the common suggestion from the two lists. If there is not a common suggestion, it should return null. Additionally, if there are multiple common suggestions in the list, the robot will pick the solution that has the highest sum of the list index. For example,

Given:

list1 = ["swim", "boat", "via bridge A", "airplane"]
list2 = ["via bridge B", "airplane", "swim", "give up"]
The robot will pick "airplane"

[Explain] both lists have "swim" and "airplane." The index for "swim" in list1 is 0 and in list2 is 2, thus the sum of them is 2. On the other hand, the index for "airplane" in list1 is 3 and in list2 is 1, thus the sum of them is 4.

Since the robot should pick the solution which has the highest sum of the list index, it will pick the airplane. If there is a choice tie, you can return any one of them.

Finally, please check below for the method signature.

public static String findRiverCrossingSolution(ArrayList<String> list1, ArrayList<String> list2)

Reference no: EM133369670

Questions Cloud

Cause planet to have extreme seasons : What axial tilt and orbital shape would cause a planet to have extreme seasons? What axial tilt and orbital shape would cause no seasonal changes through year.
What are the possible risks, and how should you proceed : whom you have no experience hands you a USB ?ash drive containing the vendor's product line catalog. What are the possible risks, and how should you proceed
Identify antecedents and consequences of the transcultural : Define the clear, characteristics, precise theoretical and/or operational definition of the transcultrual nursing concept inside and out of nursing.
How is today historic inflation of property values : How is today's historic inflation of property values the same/different than that of the early 2000s.
Since the robot should pick the solution : CCCS 301 McGill University Since the robot should pick the solution which has the highest sum of the list index, it will pick the airplane
What kind of shopper does zanetta appear : Zanetta wanted a new state-of-the-art, high-definition television. She visited a number of electronic stores carrying the major brands.
How can social media impact the health or well-being : How can social media impact the health or well—being of a person, family, or community? Select one of the groups (person, family, or community)
How are secondary data sources used in health care : How are secondary data sources used in health care?
Provide an overview on what it systems they will need : provide an overview on what IT systems they will need to support their widget and the company's operation. These systems should be linked and they will need

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd