You are given an integer array nums.
Your task is to determine whether all elements in the array have the same value.
You may assume that:
Return true if every element in the array is identical, otherwise return false.
[5, 5, 5, 5]
True
All elements are 5, so we return true.
[1, 1, 2, 1]
False
The array contains both 1 and 2, so we return false.
[7]
True
There is only one element, so all elements are trivially identical.
[5, 5, 5, 5]
True