Arrays - Linear Search

Why does i goes from 0 to n-1 and not n?

There are n elements in array
And array is 0 indexed
So we start from 0 and go till n-1
=>Total elements =end -start+1=(n-1)-(0)+1=n

So our last element is on arr[n-1]

If this resolves ur doubt then please mark this as resolved :slight_smile: