Skip to content
Advertisement

Iterating over arrays Check if an array contains two numbers

Write a program that reads an unsorted array of integers and two numbers n and m. The program must check if n and m occur next to each other in the array (in any order).

Input data format

  • The first line contains the size of an array.
  • The second line contains elements of the array.
  • The third line contains two integer numbers n and m.

All numbers in the same line are separated by the space character.

Output data format

Only a single value: true or false.

JavaScript

Advertisement

Answer

I think it can help you:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement