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

  Devise a section of code that moves all of the integers

Assume startQ contains elements of type int and both evenQ and oddQ are empty. Devise a section of code that moves all of the integers from startQ.

  Discuss the meaning information governance

Define and discuss the meaning Information Governance in context of Enterprise. Identify 5 or more questions organizations are asking themselves about.

  What are the basic goals of dijkstras least-cost algorithm

What are the basic goals of Dijkstra's least-cost algorithm? How can flooding be used to transmit a data packet from one end of the network to another?

  Which sniffer tool is designed to intercept passwords

Which sniffer tool is designed to intercept and reveal passwords? Which of following is an application-level scanner? Who originally designed and created Linux?

  List and define four types of disasters than can occur

List and define four types of disasters than can occur to an Active Directory infrastructure. What strategies could be implemented if these disasters occurred?

  Plot astronomical distances and path of celestial objects

I think that one of the most interesting fields where conic sections are applied is astronomy. As a welder, I had to cut ellipse-shaped holes into the side of tanks routinely.

  How social media provides a competitive advantage

Analyze how social media provides a competitive advantage for an organization's Web strategy, given that many companies have started hiring personnel to handle.

  Write an arduino code to program a robot to move forward

Write an arduino code to program a robot to move forward and check if there is an obstacle it will move backward to avoid it.

  Discuss about the wlan functionality

Compare the typical wireless networking equipment used in a home or small-office wireless network to that of a corporate wireless network.

  Identify emergent application of currently existing solution

Students may choose a new, original technology solution, or identify the emergent application of a currently existing solution.

  How your architecture approaches the concepts

Pick an architecture. Do research to find out how your architecture approaches the concepts introduced in this chapter. For example, what representation does it use for negative values?

  How are the topics of the two articles related

Research at least two articles on the topic of big data and its business impacts. Write a brief synthesis and summary of the two articles.

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