Scala Programming: Check if the value of the fast or last position of a given array are same or not
Write a Scala program to check if the value of the fast or last element of a given array ( length 1 or more) are same or not.
Sample Solution:
Scala Code:
Sample Output:
Check fast or last element of a given array are same or not! Original Array elements: 1, 2, 3, 4, 5, 6, Result: false Original Array elements: 1, 2, 3, 4, 5, 1, Result: true
Scala Code Editor :
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Scala program to calculate the average value of an array of element.
Next: Write a Scala program to find the index of an element in a given Array.
What is the difficulty level of this exercise?