Search Insert Position

Опубликовано: 01 Июнь 2026
на канале: AutomationDigest
193
10

This video explains a very basic programming interview question which is to find the correct position to insert an element in a already sorted array.All elements of array are sorted.The element may be already present in array and so we just need to return its index in this case.If element is not present then return the index where it can be inserted so that array remains in ascending order.This can be simply solved in linear time using linear search but since the array is sorted, we can apply binary search which will reduce time to logN.