Size of indices Array

Here, we have taken an array indices which is null(int[] indices = null;) at the start, but what if we have taken an array named indices of length array ( int[] indices = new int[arr.length]) instead of it ?.

Hi @abhishekjohri98,
If we have taken a array as int indices[]=new int[arr.length] and we only have arr.length as 5 but at only three indices we find the target number then at the rest of the indices we will have zero stored and hence it will give us wrong information that at zero index there is the target number stored.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.