either24

Objective: Write program code to create, traverse, and manipulate elements in 1D array or ArrayList objects.
Given a list of ints, return true if the list contains a 2 next to a 2 or a 4 next to a 4, but not both.

either24([1, 2, 2])  -> true

either24([4, 4, 1])  -> true
either24([4, 4, 1, 2, 2])  -> false 

The following are methods of a list that can be used to manipulate the contained data.

Type your solution        
Skills Practiced:
3.C
3.D
4.A
4.B
Copyright © StudyCS 2024 All rights reserved.