Arrays Problem Set 2

Array.4 Common End

Given 2 arrays of ints, A and B, display true if they have the same first element or they have the same last element. Both arrays will be length 1 or more.

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

Solutions:

python

raptor

Array.5 Sum 3

Given an array of ints length 3, display the sum of all the elements.

Test Case
Input
Program Output
1 {1,2,1} 4
2 {5,8,9} 22
3 {1,2,3} 6

Solutions:

python

raptor

Array.6 Rotate Left

Given an array of ints length 3, "rotate left" the elements, so {1, 2, 3} becomes {2, 3, 1}. Return the changed array.

Test Case
Input
Program Output
1 {1, 2, 3} {2, 3, 1}
2 {5, 11, 9} {11, 9, 5}
3 {7, 0, 0} {0, 0, 7}

Solutions:

python

raptor