perfect code for pass all case of leetcode:=> public int search(int[] nums, int target) { int start = 0; int end = nums.length-1; while(start nums[mid] && target
Great explanation always , your solution wont work for this array int[] nums = {7, 8, 9, 0, 1, 2, 3, 4, 5, 6}; , i think you have to correct left portion of array checking with if(nums[start]
Best Explanation I've seen !!! Thank you 🙏🙏🙏🙏🙏🙏 keep up the great work!
Great logic building!!⭐
very easy solution.... make more videoes on leetcode problems
perfect code for pass all case of leetcode:=>
public int search(int[] nums, int target) {
int start = 0;
int end = nums.length-1;
while(start nums[mid] && target
please continue the top interview 150 leetcode question series 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Great explanation always , your solution wont work for this array int[] nums = {7, 8, 9, 0, 1, 2, 3, 4, 5, 6}; , i think you have to correct left portion of array checking with if(nums[start]
class Solution {
public int search(int[] nums, int target) {
for(int i=0; i
you saw it too 🍻
hello mam . in else part we should write target
Can you share git repository?
Thanks
Thank u mam
But it is not working on [5,1,3] array
you can do a small change here .. change second if condition inside while loop as if(nums[st]
class Solution {
public int search(int[] nums, int target) {
for(int i=0; i
bro it's time complexity is O(n) we have to do the question by O(log n)✌
@@ChinmayPatil-22 and also they ask to print -1 if we dont find element, we cant run another loop as it increases time complexity
class Solution {
public int search(int[] nums, int target) {
if(nums.length == 0 || nums == null){
return -1;
}
int n= nums.length;
int i;
for( i=0;i