NPTEL Introduction to Programming in C Assignment 2 Question 2
You are given a sorted (either in the increasing or in the decreasing order) sequence of numbers, ending with a -1. You can assume that are at least two numbers before the ending -1.
Let us call the sequence x0 x1 ... xn -1.
You have to output the number of distinct elements in the sorted sequence.
Kindly do not use arrays in the code.
5 4 4 3 -1
3
1 2 -1
2
12 33 87 87 87 87 87 94 112 120 -1
6
1 2 2 -1
2