Binary Search problem | Part 46 | DSA in java in telugu | Engineering Animuthyam

  Рет қаралды 1,320

engineering animuthyam

engineering animuthyam

Күн бұрын

Пікірлер: 22
@Y.NAGABHUSHANAYEDDULA
@Y.NAGABHUSHANAYEDDULA 24 күн бұрын
class Solution { public int maximumCount(int[] nums) { int negcount=0; int poscount=0; int ans=0; for(int i=0;i
@unknownuser-h9r
@unknownuser-h9r 24 күн бұрын
macha we can also consider leftmost of zero and right most of zero. i sovled in this way.
@ajayramavath8413
@ajayramavath8413 24 күн бұрын
Did this in my first try ->Found left most of zero and right most of zero and solved : public static int maximumCount(int[] nums) { int l = left(nums); int r = right(nums); return Math.max(l, nums.length - r - 1); } private static int left(int[] nums) { int start = 0; int end = nums.length - 1; int target = 0; while (start = target) { end = mid - 1; } else { start = mid + 1; } } return start; } private static int right(int[] nums) { int start = 0; int end = nums.length - 1; int target = 0; while (start target) { end = mid - 1; } else { start = mid + 1; } } return end; } Did this after the second hint -> Found left most of Zero and One and solved.: public static int maximumCount2(int[] nums) { int l = left(nums, 0); int r = left(nums, 1); return Math.max(l, nums.length - r); } private static int left(int[] nums, int target) { int start = 0; int end = nums.length - 1; while (start = target) { end = mid - 1; } else { start = mid + 1; } } return start; }
@ivsc
@ivsc 24 күн бұрын
tried and colved it macha class Solution { public int maximumCount(int[] nums) { int c1=bsn(nums,0); int c2=bsn(nums,1); System.out.println(c1+" "+c2); return Math.max(c1, nums.length-c2); } public int bsn(int[] nums,int num) { int low=0,high=nums.length-1; while(low=num) { high=mid-1; } else low=mid+1; } return high+1; } }
@Naveen_Reddy17
@Naveen_Reddy17 23 күн бұрын
Dont stop till we get enough 😅
@saitejamukkerla
@saitejamukkerla 21 күн бұрын
2nd attempt left most of 1 and right most of -1 chesa class Solution { public int maximumCount(int[] arr) { int pos=Bsl(arr,1); int neg=Bsr(arr,-1); int positive=arr.length-pos; int negitive=neg+1; return Math.max(positive,negitive); } public static int Bsl(int []arr,int target){ int low=0; int high=arr.length-1; while(low=target){ high=mid-1; } else{ low=mid+1; } } if(low
@rikkiteja4317
@rikkiteja4317 23 күн бұрын
Enti macha channel pettina starting loni break lu vundavu ani cheppav but intha valuable content neripisthu break lu isthunav maa lanti vallani andarni disappoint chesthunnav
@engineeringanimuthyam
@engineeringanimuthyam 23 күн бұрын
@@rikkiteja4317 video cmng macha eroju kuda uploading lo undhi 🤧
@edevenkatarajesh2622
@edevenkatarajesh2622 3 күн бұрын
Brute force approach Time complexity is : O(n) Space complexity is : O(1) class Solution { public int maximumCount(int[] nums) { int n = nums.length; int neg = 0; int pos = 0; for (int i = 0; i < n; i++) { if (nums[i] < 0) { neg++; } else if (nums[i] > 0) { pos++; } } return Math.max(neg, pos); } } 💫💫💫💫
@WORK-HARD-jm4cg
@WORK-HARD-jm4cg 24 күн бұрын
solution chudakunda class Solution(object): def maximumCount(self, nums): count1=0 count2=0 for i in range(len(nums)): if nums[i] >0: count1=count1+1 elif nums[i]
@Ammuuuammu-jf7hn
@Ammuuuammu-jf7hn 23 күн бұрын
Hii bro tcs code vita gurchi kodha chepandii bro ela preape avali ani plss ❤
@WORK-HARD-jm4cg
@WORK-HARD-jm4cg 24 күн бұрын
class Solution(object): def maximumCount(self, nums): x=self.countpositive(nums) y=self.countnegative(nums) print(y) return max(x,y) def countpositive(self,nums): l=0 r= len(nums)-1 while l0 and(mid==0 or nums[mid-1]
@satyateja-ls7pk
@satyateja-ls7pk 23 күн бұрын
solved it in 1st attempt macha❤ class Solution { public int lzero(int[] nums){ int l =0; int ansl=0; int r = nums.length-1; int target=0; while(l=target){ r = mid-1; } else l = mid+1; } return l; } public int rzero(int[] nums){ int l =0; int ansr=0; int r = nums.length-1; int target=0; while(l
@Bhargav3207
@Bhargav3207 4 күн бұрын
macha without any helps and hints try chesa used left most and right most of 0 to get the answer class Solution { public int left(int[] nums){ int l=0; int r=nums.length-1; while(l
@sathvikchintalapudi496
@sathvikchintalapudi496 24 күн бұрын
macchhaa andharu edho comments peduthunte lite theeskunna kaani ee video lo nuv just chinna hint ivvagaane bale solution vacchindhi macchaa nijam ga edho teliyani excitement plzz macchaa ee series matram nuv asalu aapaku
@engineeringanimuthyam
@engineeringanimuthyam 24 күн бұрын
🎊
@jaswanthandhavarapu4325
@jaswanthandhavarapu4325 24 күн бұрын
class Solution { public int maximumCount(int[] nums) { int countP = firstAndLastP(nums,false) - firstAndLastP(nums,true); int countN = firstAndLastN(nums,false) - firstAndLastN(nums,true); int max = Math.max(countP,countN); return max; } public int firstAndLastN(int[] nums, boolean findFirst){ int low = 0; int high = nums.length - 1; while(low
@WORK-HARD-jm4cg
@WORK-HARD-jm4cg 24 күн бұрын
Sorry to ask you again and again . But thappatle macha . Please em anukoku . Estimated month ? For the completion of entire DSA ? Cheppu macha kastha . Memu oka preparation lo untam
@jaswanthandhavarapu4325
@jaswanthandhavarapu4325 24 күн бұрын
bro naku telisi oka 4 - 5 months padutundhi because he is explaining all types of problems which we will be asked in online assements and online interviews
@engineeringanimuthyam
@engineeringanimuthyam 24 күн бұрын
Inko 2 months lo basics ante under 10 lpa lopu adigevi finish cheyali next 2 months lo motham dsa finish cheyali
@lavan1119
@lavan1119 15 күн бұрын
class Solution { public static int pos(int[] nums) { int l = 0; int r = nums.length - 1; while (l 0) { l = mid; if (mid > 0 && nums[mid - 1] > 0) { l = mid - 1; } else { return r - l + 1; } } else { r = mid - 1; } } return 0; } public int neg(int[] nums) { int l = 0; int r = nums.length - 1; while (l
@lavan1119
@lavan1119 15 күн бұрын
macha time limit exceed
Binary Search Problem | Part 47 | DSA in java in telugu | Engineering Animuthyam
32:39
КОГДА К БАТЕ ПРИШЕЛ ДРУГ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 8 МЛН
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 62 МЛН
Binary Search Problem | Part 49 | DSA in java in telugu | Engineering Animuthyam
37:15
Meeku jobs enduku ravatledu? | Vamsi Bhavani
9:06
Vamsi Bhavani
Рет қаралды 9 М.
Fresher's Intro 2024 || IIT BOMBAY || Telugu || @InstiDiaries
11:13
Insti Diaries [ IIT BOMBAY ]
Рет қаралды 105 М.
P26 - Arrays (Single Dimensional) in Java | Core Java | Java Programming |
54:55
H Y R Tutorials - Telugu
Рет қаралды 200 М.