filmov
tv
Search Insert Position | Leetcode #35

Показать описание
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.I have shown all possible cases with examples and the code walkthrough at the end of the video.CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
=================================================================
=================================================================
=================================================================
=================================================================
Комментарии