Saved Bookmarks
| 1. |
What contins only one value |
|
Answer» Step-by-step explanation: Given an ARRAY arr[] of size N, the task is to check if the array contains only ONE distinct element or not. If it contains only one distinct element then print “Yes”, otherwise print “No”. Examples: Input: arr[] = {3, 3, 4, 3, 3} OUTPUT: No Explanation: There are 2 distinct elements present in the array {3, 4}. Therefore, the output is No. Input: arr[] = {9, 9, 9, 9, 9, 9, 9} Output: Yes Explanation: The only distinct element in the array is 9. Therefore, the output is Yes. |
|