Question: Hey, I have a question from my data structures class. I took java a year ago and am very rusty. Really need help writing this
Hey, I have a question from my data structures class. I took java a year ago and am very rusty. Really need help writing this code. Here is the QUESTION:
Given an array of ints, return true if 6 appears as either the first or last element in the array. The array will be length 1 or more.
OUTPUT NEEDED:
firstLast6([1, 2, 6]) true firstLast6([6, 1, 2, 3]) true firstLast6([13, 6, 1, 2, 3]) false
WE ARE GIVEN:
public boolean firstLast6(int[] nums) { }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
