Arrays Problem Set 1

Array.1 First Last 6

Given an array of ints, display true if 6 appears as either the first or last element in the array. The array will be length 1 or more.

Test Case
Input
Program Output
1 {1,3,6} true
2 {6,3,6,3,2} true
3 {1,3,2} false

Solutions:

python

raptor

Array.2 Same First Last

Given an array of ints, display true if the array is length 1 or more, and the first element and the last element are the same.

Test Case
Input
Program Output
1 {1,2,1} true
2 {1,2,3,1} true
3 {1,2,3} false

Solutions:

python

raptor

Array.3 Make Pie

Display an int array length 3 containing the first 3 digits of pi, {3, 1, 4}.

Test Case
Input
Program Output
1   {3,1,4}

Solutions:

python

raptor