- 22
- 813
Tech Boy Anil
Приєднався 9 тра 2020
Welcome to Our Channel
Here you finds about TECH updates , EDITING tutorials and much more stuff
Here you finds about TECH updates , EDITING tutorials and much more stuff
1792. Maximum Average Pass Ratio
Problem Link : leetcode.com/problems/maximum-average-pass-ratio/description/
-----------------------------------
Social Links
Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw==
Linkedin : www.linkedin.com/in/anil-kotapuri/
portfolio : anilkotapuri.online/
Leetcode : leetcode.com/u/anilkotapuri/
HackerRank : www.hackerrank.com/profile/anilkotapuri
-----------------------------------
Social Links
Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw==
Linkedin : www.linkedin.com/in/anil-kotapuri/
portfolio : anilkotapuri.online/
Leetcode : leetcode.com/u/anilkotapuri/
HackerRank : www.hackerrank.com/profile/anilkotapuri
Переглядів: 36
Відео
2762. Continuous Subarrays || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 20День тому
Problem Link : leetcode.com/problems/continuous-subarrays/description/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2593. Find Score of an Array After Marking All Elements || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 11День тому
Problem Link : leetcode.com/problems/find-score-of-an-array-after-marking-all-elements/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2558. Take Gifts From the Richest Pile || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 7День тому
Problem Link : leetcode.com/problems/take-gifts-from-the-richest-pile/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2779. Maximum Beauty of an Array After Applying Operation || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 1314 днів тому
Problem Link : leetcode.com/problems/maximum-beauty-of-an-array-after-applying-operation/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2981. Find Longest Special Substring That Occurs Thrice I || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 2114 днів тому
Problem Link : leetcode.com/problems/find-longest-special-substring-that-occurs-thrice-i/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
3152. Special Array II - Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 4014 днів тому
Problem Link : leetcode.com/problems/special-array-ii/ Infosys InStep Internship : www.infosys.com/instep.html Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2054. Two Best Non-Overlapping Events
Переглядів 1814 днів тому
Problem Link : leetcode.com/problems/two-best-non-overlapping-events/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
1760. Minimum Limit of Balls in a Bag || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 1414 днів тому
Problem Link : leetcode.com/problems/minimum-limit-of-balls-in-a-bag/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2554. Maximum Number of Integers to Choose From a Range I || Subscribe Cheyandi 🤐
Переглядів 714 днів тому
Problem Link : leetcode.com/problems/maximum-number-of-integers-to-choose-from-a-range-i/description/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2337. Move Pieces to Obtain a String || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 1214 днів тому
Problem Link : leetcode.com/problems/move-pieces-to-obtain-a-string/description/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2825. Make String a Subsequence Using Cyclic Increments || Subscribe Cheyandi 🤐
Переглядів 3721 день тому
Problem Link : leetcode.com/problems/make-string-a-subsequence-using-cyclic-increments/description/ Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linked in : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
2109. Adding Spaces to a String || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 2821 день тому
Problem Link : leetcode.com/problems/adding-spaces-to-a-string/description/ Social Links Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linkedin : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence || Subscribe Cheyandi 🤐
Переглядів 7521 день тому
Problem Link : leetcode.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/description/ Instagram : google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw Linked in : www.linkedin.com/in/anil-kotapuri/ portfolio : anilkotapuri.online/ Leetcode : leetcode.com/u/anilkotapuri/ HackerRank : www.hackerrank.com/profile/anilkotapuri
1346. Check If N and Its Double Exist || Emina Ardram itey Subscribe Cheyandi 🤐
Переглядів 13721 день тому
Problem Link : leetcode.com/problems/check-if-n-and-its-double-exist/description/?envType=daily-question&envId=2024-12-01 social links google_me_as_anil?igsh=MTFlNG8wbGtzbW4wMw www.linkedin.com/in/anil-kotapuri/ anilkotapuri.online/ leetcode.com/u/anilkotapuri/ www.hackerrank.com/profile/anilkotapuri
Electronic Voting System using Blockchain
Переглядів 152 місяці тому
Electronic Voting System using Blockchain
index html react1 Visual Studio Code 2023 11 26 12 47 39
Переглядів 30Рік тому
index html react1 Visual Studio Code 2023 11 26 12 47 39
Anilkotapuri Google Chrome 2023 11 26 12 33 22
Переглядів 31Рік тому
Anilkotapuri Google Chrome 2023 11 26 12 33 22
Code -------------------------- import java.util.Comparator; import java.util.PriorityQueue; class Solution { public double maxAverageRatio(int[][] classes, int extraStudents) { PriorityQueue<ClassDetails> maxHeap = new PriorityQueue<>(new ClassComparator()); // Populate the priority queue with initial class details for (int[] cls : classes) { maxHeap.offer(new ClassDetails(cls[0], cls[1])); } // Add extra students to maximize the average ratio while (extraStudents > 0) { ClassDetails topClass = maxHeap.poll(); if (topClass != null) { topClass.addStudent(); maxHeap.offer(topClass); } extraStudents--; } // Calculate the final average pass ratio double totalRatio = 0.0; while (!maxHeap.isEmpty()) { ClassDetails cls = maxHeap.poll(); totalRatio += cls.getPassRatio(); } return totalRatio / classes.length; } } class ClassDetails { private int pass; private int total; public ClassDetails(int pass, int total) { this.pass = pass; this.total = total; } public void addStudent() { pass++; total++; } public double getPassRatio() { return (double) pass / total; } public double potentialIncrease() { return ((double) (pass + 1) / (total + 1)) - getPassRatio(); } } class ClassComparator implements Comparator<ClassDetails> { @Override public int compare(ClassDetails c1, ClassDetails c2) { return Double.compare(c2.potentialIncrease(), c1.potentialIncrease()); } }
code ---------------------- class Solution { public long continuousSubarrays(int[] nums) { int r = 0, l = 0; int curMin, curMax; long windowLen = 0, ans = 0; curMin = curMax = nums[r]; for (r = 0; r < nums.length; r++) { curMin = Math.min(curMin, nums[r]); curMax = Math.max(curMax, nums[r]); if (curMax - curMin > 2) { windowLen = r - l; ans += ((windowLen * (windowLen + 1)) / 2); l = r; curMin = curMax = nums[r]; while (l > 0 && Math.abs(nums[r] - nums[l - 1]) <= 2) { l--; curMin = Math.min(curMin, nums[l]); curMax = Math.max(curMax, nums[l]); } if (l < r) { windowLen = r - l; ans -= ((windowLen * (windowLen + 1)) / 2); } } } windowLen = r - l; ans += ((windowLen * (windowLen + 1)) / 2); return ans; } }
Bruteforce Approach __________________________________________________ class Solution { public int maximumLength(String s) { HashMap<String, Integer> h = new HashMap<>(); char[] sr = s.toCharArray(); for(int i = 0; i < s.length(); i++) { String sub = ""; for(int j = i; j < s.length(); j++) { sub = sub + sr[j]; h.put(sub, h.getOrDefault(sub ,0)+1); } } int ans= -1; for(Map.Entry<String, Integer> obj : h.entrySet()) { HashSet<Character> h2 = new HashSet<>(); for(char i : obj.getKey().toCharArray()) { h2.add(i); } if(obj.getValue() >= 3 && obj.getKey().length() > ans && h2.size() == 1) { ans = obj.getKey().length(); } } return ans; } } Efficient Approach ------------------------------------------------------------ class Solution { public int maximumLength(String s) { int l = 1, n = s.length(); int r = n; if(!check(s, n, l)) { return -1; } while(l+1 < r) { int mid = (l + r) / 2; if(check(s, n, mid)) { l = mid; } else { r = mid; } } return l; } private boolean check(String s, int n, int mid) { int p = 0; int[] count = new int[26]; for(int i = 0; i < n; i ++) { while(s.charAt(p) != s.charAt(i)) { p++; } if(i - p +1 >= mid) { count[s.charAt(i) - 'a']++; } if(count[s.charAt(i) - 'a'] > 2) { return true; } } return false; } }
class Solution { public int minimumSize(int[] nums, int maxOperations) { Arrays.sort(nums); int left = 1, right = nums[nums.length - 1]; while(left < right) { int mid = left + (right - left) / 2; if(isvalid(nums, mid, maxOperations)) { right = mid; } else { left = mid + 1; } } return left; } private boolean isvalid(int[] nums, int mid, int maxo) { int c = 0; for(int i : nums) { if(i > mid) { c += (i - 1) / mid; } } return c <= maxo; } }
I think the logic is little confusive. Keep an eye on the logic once again
Sorry for the lags I just want to Enhance the video quality but my laptop doesn't supports me ☹☹
Bruteforce solution causing TLE ------------------------------------------------------- class Solution { public String addSpaces(String s, int[] spaces) { String res = ""; int sp = spaces[0]; int ind = 0; for(int i = 0; i < s.length(); i++) { if(i == sp) { res = res +' ' + s.charAt(i); ind++; if( ind < spaces.length) { sp = spaces[ind]; } continue; } res = res + s.charAt(i); } return res; } } Optimized Code --------------------------- class Solution { public String addSpaces(String s, int[] spaces) { char[] source = s.toCharArray(); char[] res = new char[s.length() + spaces.length]; int ind = 0, c = 0; for(int i : spaces) { while(c < i) { res[ind] = source[c]; c++; ind++; } res[ind] = ' '; ind++; } while(c < s.length()) { res[ind] = source[c]; c++; ind++; } return new String(res); } }
Happy to see you like this ra Anil ❤
baga ardamaindi thank you for making us understand the program ..........Anil garu
Chusevallu ma bro channel ni subscribe chesukondee
Broo nuvvu thopu broo
fireboltt.com/products/fire-boltt-ninja?Conversion_SW_Ninja_28052022_Sustainable_Aud_Re_ninjavisitor_India_All&fbclid=PAAaZEuNM1s-o9p_qM5jGzZXbi8MwjBVvgS7E9aja3MGpO8owgDquB2CDyU0s
Super bro