Software Dev | Tech enthusiast | Movie Reviewer | Coder | 22
Explanation: www.youtube.com/watch?v=ktuh...
Explanation: www.youtube.com/watch?v=ktuh...
Kth element of two arrays ,my brute force approach will be joining the two arrays and then sort them and return the kth element index and this comes time complexity of O((n+m)⋅log(n+m) but using binary search we can reduce this time complexity and optimise it .
#100DaysofCode
Kth element of two arrays ,my brute force approach will be joining the two arrays and then sort them and return the kth element index and this comes time complexity of O((n+m)⋅log(n+m) but using binary search we can reduce this time complexity and optimise it .
#100DaysofCode
In this we can simple sort it and return the minimum of the array. Like basically taking mini of arr takes O(N) so instead we can use binary search algorithm to find the mini of the array which takes the time complexity of O(logN).
#100daysofCode #100DaysofCodeChallenge
In this we can simple sort it and return the minimum of the array. Like basically taking mini of arr takes O(N) so instead we can use binary search algorithm to find the mini of the array which takes the time complexity of O(logN).
#100daysofCode #100DaysofCodeChallenge
Number of occurrence
Given a sorted array, arr[] and a number target, you need to find the number of occurrences of target in arr[].
Solved using the having a counter variable and increasing when looping finds a match with the target
#100daysofCodeChallenge #100daysofCode
Number of occurrence
Given a sorted array, arr[] and a number target, you need to find the number of occurrences of target in arr[].
Solved using the having a counter variable and increasing when looping finds a match with the target
#100daysofCodeChallenge #100daysofCode
thelefthook.substack.com/p/the-united...
thelefthook.substack.com/p/the-united...