Array - 11: Find Missing Number from 1 to n range in Unsorted array

preview_player
Показать описание

In this video, we're going to reveal exact steps to Find Missing Number from 1 to n range in Unsorted array in Java

CHECK OUT CODING SIMPLIFIED

★☆★ VIEW THE BLOG POST: ★☆★

I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 400+ videos.

★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★

★☆★ Send us mail at: ★☆★
Рекомендации по теме
Комментарии
Автор

1. Could you please explain why Arrays program no.44's time complexity is O(n) and why not it is O(n2) because it is having 2 loops?
2. When time complexity is the same for the below 2 programs, what is the better approach and why?

AnushaPoosala
Автор

const MISSING = (nums, lower, upper) => {
let arr = [];
for (let i = lower; i <= upper; i++) {
if (nums.indexOf(i) == -1) {
arr[i] = i;
}
}
return arr;
};

yashrajbharti
Автор

we can do the sum of n(n+1)/2 value which is 36 minus the sum of input arr which is 31
36-31 gives the missing number, instead of subtracting one by one element of array

pradeeppotnuru
Автор

please suggest what to do if n is too large to fit in sum of type int. even if we change type to long and still it cannot accomodate, then what will be the approach.

sunilkoni
Автор

plese find two numbers missing in array

RaviKumar-udgs