subject

Write a static method named contains that accepts two arrays of integers a1 and a2 as
parameters and that returns a boolean value indicating whether or not a2's sequence of
elements appears in a1 (true for yes, false for no). The sequence of elements in a2 may
appear anywhere in a1 but must appear consecutively and in the same order. For example, if
variables called list1 and list2 store the following values:

int[] list1 = {1, 6, 2, 1, 4, 1, 2, 1, 8};
int[] list2 = {1, 2, 1};

Then the call of contains(list1, list2) should return true because list2's sequence of
values {1, 2, 1} is contained in list1 starting at index 5. If list2 had stored the values {2,
1, 2}, the call of contains(list1, list2) would return false because list1 does not
contain that sequence of values. Any two lists with identical elements are considered to contain
each other, so a call such as contains(list1, list1) should return true.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:00
What are procedures that keep a data base current
Answers: 1
question
Computers and Technology, 22.06.2019 19:50
Write a car class having two private member variables called tank and speed. write public methods called pumpgas and gofast. the method pumpgas gets an integer for gas that must be pumped. that value needs to be added to tank (no more than 20 gallons). it must return the amount of gas that is purchased ($4 per gallon). the method gofast should increase the speed by 5 each time it is called.write a constructor for the above class that initialized both variables to zero.write a tostring to display both the tank and speed when the car is printed.modify the car class to implement the interface comparable and an interface called carinter having the public methods in carinter.write the main program to create an array of size 5 of type car. create 5 car objects having each location of the array to refer to one of the cars. test the pumpgas, gofast, equals method on the array items. write an enhanced loop to print all the car values (using a tostring written last time).write a generic method to find the minimum of four items. pass int, double, char, string and car objects to test this method.
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
You know the right answer?
Write a static method named contains that accepts two arrays of integers a1 and a2 as
paramet...
Questions
question
Mathematics, 21.05.2020 08:58
question
Mathematics, 21.05.2020 08:58
question
English, 21.05.2020 08:58
question
Mathematics, 21.05.2020 08:58
question
History, 21.05.2020 08:58
Questions on the website: 13722363