Arnab Bhadra
Arnab Bhadra
  • 52
  • 15 089
Leetcode Weekly Contest 425 All Solutions #algorithm #coding
Leetcode Weekly Contest 425
Problem Link: leetcode.com/contest/weekly-contest-425/problems/minimum-positive-sum-subarray/
Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/
programiming video
coding video
youtube code
educational video
learning videos
informational video
youtube for students
educational videos for adults
#dsa #datastructures #algorithm #leetcode #potd #coding #arrray #strings #codingtips #codinglife #codingtutorial #codingchallenge #binarysearchtree #leetcodechallenge #leetcodeweeklycontest418 #leetcodecontest
Переглядів: 319

Відео

Biweekly Contest 144 All Solutions | #algorithm #education
Переглядів 7227 годин тому
Biweekly Contest 144 Problem Link: leetcode.com/contest/biweekly-contest-143/problems/smallest-divisible-digit-product-i/ Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/ programiming video coding video youtube code educational video learning videos informational video youtube for students educational videos for adults #dsa #datastructures #algorithm #leetcode #potd #coding #arrray #string...
GFG NEW SWAGS (GFG Bag) New Update | GfG160 - 160 Days of Problem Solving #algorithm #coding
Переглядів 8016 годин тому
GfG160 is designed to offer a comprehensive, topic-wise coding challenge over the span of 160 days. Every day, participants will receive a handpicked coding problem that covers a variety of topics essential for interviews, making it perfect for students and working professionals aiming to sharpen their skills. Along with the problem, you’ll get access to relevant articles and editorial videos t...
GfG Weekly - 181[Rated Contest] All Solutions #algorithm #coding
Переглядів 20821 годину тому
GfG Weekly - 181 Problem Link: practice.geeksforgeeks.org/contest/gfg-weekly-181-rated-contest/problems Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/ programiming video coding video youtube code educational video learning videos informational video youtube for students educational videos for adults #dsa #datastructures #algorithm #gfg #potd #coding #arrray #strings #codingtips #codingli...
GFG NEW SWAGS Bag Criteria Changed | GfG160 - 160 Days of Problem Solving #algorithm #coding
Переглядів 598День тому
GfG160 is designed to offer a comprehensive, topic-wise coding challenge over the span of 160 days. Every day, participants will receive a handpicked coding problem that covers a variety of topics essential for interviews, making it perfect for students and working professionals aiming to sharpen their skills. Along with the problem, you’ll get access to relevant articles and editorial videos t...
GFG NEW SWAGS Bag | GfG160 - 160 Days of Problem Solving | GFG Daily POTD #algorithm #coding
Переглядів 338День тому
GfG160 is designed to offer a comprehensive, topic-wise coding challenge over the span of 160 days. Every day, participants will receive a handpicked coding problem that covers a variety of topics essential for interviews, making it perfect for students and working professionals aiming to sharpen their skills. Along with the problem, you’ll get access to relevant articles and editorial videos t...
Nearly sorted | GFG POTD Challenge | Problem of The Day | Priority Queue #algorithm #education
Переглядів 16День тому
Given an array arr[], where each element is at most k away from its target position, you need to sort the array optimally. Note: DO NOT use STL sort() function for this question. Examples: Input: arr[] = [6, 5, 3, 2, 8, 10, 9], k = 3 Output: [2, 3, 5, 6, 8, 9, 10] Explanation: The sorted array will be 2 3 5 6 8 9 10 Input: arr[]= [1, 4, 5, 2, 3, 6, 7, 8, 9, 10], k = 2 Output: [1, 2, 3, 4, 5, 6,...
Meeting Rooms | GFG Daily POTD Challenge | Problem of The Day | 2D Arrays #algorithm #education
Переглядів 2614 днів тому
Given an array arr[][] such that arr[i][0] is the starting time of ith meeting and arr[i][1] is the ending time of ith meeting, the task is to check if it is possible for a person to attend all the meetings such that he can attend only one meeting at a particular time. Note: A person can attend a meeting if its starting time is greater than or equal to the previous meeting's ending time time. P...
Make array elements unique | GFG Daily Challenge | Problem of The Day | Arrays #algorithm #education
Переглядів 3914 днів тому
Given an array arr[ ], your task is to find the minimum number of increment operations required to make all the elements of the array unique. i.e.- no value in the array should occur more than once. In one operation, a value can be incremented by 1 only. Problem Link: www.geeksforgeeks.org/problems/make-array-elements-unique 170645/1 Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/ program...
GfG Weekly - 180 All Solutions #algorithm #coding
Переглядів 30014 днів тому
GfG Weekly - 180 Problem Link: practice.geeksforgeeks.org/contest/gfg-weekly-180-rated-contest/problems Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/ programiming video coding video youtube code educational video learning videos informational video youtube for students educational videos for adults #dsa #datastructures #algorithm #gfg #potd #coding #arrray #strings #codingtips #codingli...
Weekly Contest 423 All Solutions | #algorithm #educational
Переглядів 42414 днів тому
Weekly Contest 423 Problem Link: leetcode.com/contest/weekly-contest-423/problems/adjacent-increasing-subarrays-detection-i/description/ Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/ programiming video coding video youtube code educational video learning videos informational video youtube for students educational videos for adults #dsa #datastructures #algorithm #leetcode #potd #coding ...
Biweekly Contest 143 All Solutions | #algorithm #education
Переглядів 1,2 тис.14 днів тому
Biweekly Contest 143 Problem Link: leetcode.com/contest/biweekly-contest-143/problems/smallest-divisible-digit-product-i/ Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/ programiming video coding video youtube code educational video learning videos informational video youtube for students educational videos for adults #dsa #datastructures #algorithm #leetcode #potd #coding #arrray #string...
Minimum sum | GFG POTD Daily Challenge | Problem of The Day | Arrays #algorithm #education
Переглядів 2214 днів тому
Given an array arr[] such that each element is in the range [0 - 9], find the minimum possible sum of two numbers formed using the elements of the array. All digits in the given array must be used to form the two numbers. Return a string without leading zeroes. Problem Link: www.geeksforgeeks.org/problems/minimum-sum4058/1 Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/ programiming video...
Weekly Contest 422 All Solutions | #algorithm #educational
Переглядів 1 тис.21 день тому
Weekly Contest 420 Problem Link: leetcode.com/contest/weekly-contest-422/problems/check-balanced-string/description/ Linkedin: www.linkedin.com/in/arnab-bhadra-110001218/ programiming video coding video youtube code educational video learning videos informational video youtube for students educational videos for adults #dsa #datastructures #algorithm #leetcode #potd #coding #arrray #strings #co...
GfG Weekly - 177 All Solutions #algorithm #coding
Переглядів 273Місяць тому
GfG Weekly - 177 All Solutions #algorithm #coding
Weekly Contest 420 All Solutions | #algorithm #educational
Переглядів 952Місяць тому
Weekly Contest 420 All Solutions | #algorithm #educational
Weekly Contest 420 All Solutions | #algorithm #educational
Переглядів 776Місяць тому
Weekly Contest 420 All Solutions | #algorithm #educational
Weekly Contest 419 All Solutions | #algorithm #educational
Переглядів 508Місяць тому
Weekly Contest 419 All Solutions | #algorithm #educational
Weekly Contest 419 All Solutions | #algorithm #education
Переглядів 483Місяць тому
Weekly Contest 419 All Solutions | #algorithm #education
Biweekly Contest 141 All Solutions | #algorithm #education
Переглядів 353Місяць тому
Biweekly Contest 141 All Solutions | #algorithm #education
Biweekly Contest 141 All Solutions | #algorithm #educationalvideo
Переглядів 712Місяць тому
Biweekly Contest 141 All Solutions | #algorithm #educationalvideo
Biweekly Contest 141 All Solutions | #algorithm #education
Переглядів 739Місяць тому
Biweekly Contest 141 All Solutions | #algorithm #education
XOR Linked List | GFG POTD Daily Challenge | Problem of The Day | Linked List #algorithm #education
Переглядів 49Місяць тому
XOR Linked List | GFG POTD Daily Challenge | Problem of The Day | Linked List #algorithm #education
GfG Weekly - 175 [Rated Contest] All Solutions(4th qs) #algorithm #coding
Переглядів 105Місяць тому
GfG Weekly - 175 [Rated Contest] All Solutions(4th qs) #algorithm #coding
GfG Weekly - 175 [Rated Contest] All Solutions #algorithm #coding
Переглядів 168Місяць тому
GfG Weekly - 175 [Rated Contest] All Solutions #algorithm #coding
Leetcode Weekly Contest 418 All Solutions | #algorithm #education
Переглядів 948Місяць тому
Leetcode Weekly Contest 418 All Solutions | #algorithm #education
Leetcode Weekly Contest 418 All Solutions | #algorithm #education
Переглядів 602Місяць тому
Leetcode Weekly Contest 418 All Solutions | #algorithm #education
Leetcode Weekly Contest 418 All Solutions | #algorithm #education
Переглядів 1,2 тис.Місяць тому
Leetcode Weekly Contest 418 All Solutions | #algorithm #education
Not a subset sum | GFG POTD Daily Challenge | Problem of The Day | Array #algorithm#education
Переглядів 93Місяць тому
Not a subset sum | GFG POTD Daily Challenge | Problem of The Day | Array #algorithm#education
Majority Vote | GFG POTD Daily Challenge | Problem of The Day | Moore Voting #algorithm #education
Переглядів 33Місяць тому
Majority Vote | GFG POTD Daily Challenge | Problem of The Day | Moore Voting #algorithm #education

КОМЕНТАРІ

  • @priyamourya2023
    @priyamourya2023 День тому

    Sir, if I start the challenge today, should I complete all the questions starting from 15th of Nov up till date ? Or do I need to solve starting from the first question one by one each day ?

    • @ArnabBhadra02
      @ArnabBhadra02 День тому

      @@priyamourya2023 you have to post in LinkedIn from today and till 80 days . And you have to complete all the questions in gfg 160 sections till todays date and continue this

  • @VarnikaSaraswat-s5d
    @VarnikaSaraswat-s5d 2 дні тому

    Is it necessary to post daily? i started 5 days back but did not post yet .How should i start posting?

    • @ArnabBhadra02
      @ArnabBhadra02 День тому

      to get swag u have to post daily, yes post from today and continue till 80 days

  • @TasneemMohammad-oj3ie
    @TasneemMohammad-oj3ie 2 дні тому

    can i start today as of 24nov?

    • @ArnabBhadra02
      @ArnabBhadra02 2 дні тому

      @@TasneemMohammad-oj3ie yes you can

    • @itipurwar2730
      @itipurwar2730 Годину тому

      @@ArnabBhadra02 sir jo 10 problems nhi ho payi h wo kab complete krenge

  • @ArnabBhadra02
    @ArnabBhadra02 2 дні тому

    Plz do subscribe if you find it helpful

  • @ArnabBhadra02
    @ArnabBhadra02 2 дні тому

    soln3: from typing import List import math class Solution: def checkOp12(self, x: int, del_val: int) -> bool: y = (x + 1) // 2 return y >= del_val def minArraySum(self, nums: List[int], k: int, op1: int, op2: int) -> int: n = len(nums) INF = float('inf') f = [[[INF] * (op2 + 1) for _ in range(op1 + 1)] for _ in range(n + 1)] f[0][0][0] = 0 for i in range(1, n + 1): for j in range(min(op1, i) + 1): for l in range(min(op2, i) + 1): f[i][j][l] = min(f[i][j][l], f[i - 1][j][l] + nums[i - 1]) if j >= 1: f[i][j][l] = min(f[i][j][l], f[i - 1][j - 1][l] + (nums[i - 1] + 1) // 2) if l >= 1 and nums[i - 1] >= k: f[i][j][l] = min(f[i][j][l], f[i - 1][j][l - 1] + (nums[i - 1] - k)) if j >= 1 and l >= 1 and self.checkOp12(nums[i - 1], k): f[i][j][l] = min(f[i][j][l], f[i - 1][j - 1][l - 1] + (nums[i - 1] + 1) // 2 - k) if j >= 1 and l >= 1 and nums[i - 1] >= k: f[i][j][l] = min(f[i][j][l], f[i - 1][j - 1][l - 1] + ((nums[i - 1] - k) + 1) // 2) ans = INF for i in range(op1 + 1): for j in range(op2 + 1): ans = min(ans, f[n][i][j]) return ans

  • @ArnabBhadra02
    @ArnabBhadra02 2 дні тому

    subscriber target 135

  • @ArnabBhadra02
    @ArnabBhadra02 2 дні тому

    soln1: class Solution: def minimumSumSubarray(self, nums, l, r): n = len(nums) min_positive_sum = float('inf') for size in range(l, r + 1): current_sum = sum(nums[:size]) if current_sum > 0: min_positive_sum = min(min_positive_sum, current_sum) for i in range(size, n): current_sum += nums[i] - nums[i - size] if current_sum > 0: min_positive_sum = min(min_positive_sum, current_sum) return -1 if min_positive_sum == float('inf') else min_positive_sum

  • @ArnabBhadra02
    @ArnabBhadra02 2 дні тому

    Soln2: from collections import Counter class Solution: def isPossibleToRearrange(self, s: str, t: str, k: int) -> bool: n = len(s) sub_length = n // k s_freq = {} for i in range(k): freq_map = Counter(s[i * sub_length: (i + 1) * sub_length]) s_freq[frozenset(freq_map.items())] = s_freq.get(frozenset(freq_map.items()), 0) + 1 t_freq = {} for i in range(k): freq_map = Counter(t[i * sub_length: (i + 1) * sub_length]) t_freq[frozenset(freq_map.items())] = t_freq.get(frozenset(freq_map.items()), 0) + 1 return s_freq == t_freq

  • @ArnabBhadra02
    @ArnabBhadra02 2 дні тому

    Soln4: class Solution: def maximizeSumOfWeights(self, edges: List[List[int]], k: int) -> int: n = len(edges) degree = [0] * (n + 1) for edge in edges: degree[edge[0]] += 1 degree[edge[1]] += 1 edges.sort(key=lambda x: x[2]) result = 0 for edge in edges: if degree[edge[0]] > k or degree[edge[1]] > k: degree[edge[0]] -= 1 degree[edge[1]] -= 1 else: result += edge[2] return result

  • @DeeneeKingz
    @DeeneeKingz 2 дні тому

    what about second question

  • @Harsh-7-G
    @Harsh-7-G 3 дні тому

    sir can they cover all the topics question in dsa should i prepare this for my placement i am final year student or i should go apna collage dsa sheet for college placements

    • @ArnabBhadra02
      @ArnabBhadra02 3 дні тому

      @@Harsh-7-G Both are good All you need to do more and more practice No matter from where you are learning You will not learn anything until you are going for implementation. So watch tutorial do practice everyday new problems And make some impressive projects also

  • @purushothaman2073
    @purushothaman2073 3 дні тому

    Nice 👍

  • @ArnabBhadra02
    @ArnabBhadra02 3 дні тому

    Subscribers target 150

  • @ArnabBhadra02
    @ArnabBhadra02 3 дні тому

    soln2: class Solution: def shiftDistance(self, s: str, t: str, nextCost: list[int], previousCost: list[int]) -> int: n=len(s) totalCost=0 for i in range(n): start=ord(s[i])-ord('a') target=ord(t[i])-ord('a') clockwiseShifts=(target-start+26)%26 clockwiseCost=0 for j in range(clockwiseShifts): clockwiseCost+=nextCost[(start+j)%26] counterClockwiseShifts=(start-target+26)%26 counterClockwiseCost=0 for j in range(counterClockwiseShifts): counterClockwiseCost+=previousCost[(start-j+26)%26] totalCost+=min(clockwiseCost,counterClockwiseCost) return totalCost

  • @ArnabBhadra02
    @ArnabBhadra02 3 дні тому

    int step=10; int flag =1; while(n>=step){ n-=step; flag*=-1; step--; } return flag!=1;

  • @IPV-252
    @IPV-252 6 днів тому

    Is only for Top 100 Candidates???😢 Bag Pack only given by Luckydraw????😢

  • @Dead_Striker17
    @Dead_Striker17 6 днів тому

    If I start from today... should i solve all the problems of past days or just today's problem

    • @ArnabBhadra02
      @ArnabBhadra02 6 днів тому

      @@Dead_Striker17 yes you have to solve all the problem in gfg 160 days section And upload only today's potd

    • @nagato007
      @nagato007 5 днів тому

      ​@@ArnabBhadra02how to upload on twitter plz sir

    • @ArnabBhadra02
      @ArnabBhadra02 5 днів тому

      @@nagato007 same as LinkedIn Just take a ss of your solved code and post with a write up with hashtags

  • @ArnabBhadra02
    @ArnabBhadra02 7 днів тому

    To claim bag: 1) Register in GFG 160 days course (www.geeksforgeeks.org/batch/gfg-160-problems?tab=Noticeboard) 2)Pst in linkedin using those 2 hashtags (sample post:- www.linkedin.com/posts/arnab-bhadra-110001218_geekstreak2024-gfg160-geeksforgeeks-activity-7264087306951618560-zUa1? )

  • @clashfamily413
    @clashfamily413 8 днів тому

    bhai gurantee bag milega

    • @ArnabBhadra02
      @ArnabBhadra02 7 днів тому

      Watch recent video Yes guarantee milega

  • @krittikachoudhuri4256
    @krittikachoudhuri4256 8 днів тому

    Do we need to upload the POTD solution everyday on LinkedIn or X, for claiming the bag in #160dayschallenge or do we need to make a single post on the 160th day?

    • @divakarsai6238
      @divakarsai6238 7 днів тому

      We should upload post every day without missing even one day to maintain the streak

    • @ArnabBhadra02
      @ArnabBhadra02 7 днів тому

      check my new video all doubts will be cleared.

    • @ArnabBhadra02
      @ArnabBhadra02 7 днів тому

      check my new video all doubts will be cleared. Yes you have to upload post without missing a day

  • @ganeshjaggineni4097
    @ganeshjaggineni4097 8 днів тому

    Is it required to read article,watch video or just solve the problem and posted in LinkedIn is enough

    • @ArnabBhadra02
      @ArnabBhadra02 8 днів тому

      @@ganeshjaggineni4097 to avail certificate you have to watch videos and read articles. And for swags you can just solve and post it on LinkedIn

  • @Gangstar-yb1uf
    @Gangstar-yb1uf 9 днів тому

    Soln3 : in Python class Solution: def minDistance(self, alice, bob, apples): from functools import lru_cache def manhattan(x1, y1, x2, y2): return abs(x1 - x2) + abs(y1 - y2) @lru_cache(None) def dp(index, ax, ay, bx, by): if index == len(apples): return 0 x, y = apples[index] alice_distance = manhattan(ax, ay, x, y) + dp(index + 1, x, y, bx, by) bob_distance = manhattan(bx, by, x, y) + dp(index + 1, ax, ay, x, y) return min(alice_distance, bob_distance) return dp(0, alice[0], alice[1], bob[0], bob[1])

  • @Gangstar-yb1uf
    @Gangstar-yb1uf 9 днів тому

    Soln2: in C++ class Solution { public: int getCount(int n) { const int MOD = 1e9 + 7; vector<vector<int>> dp(n + 1, vector<int>(2, 0)); dp[0][0] = 1; dp[0][1] = 0; for (int i = 1; i <= n; ++i) { dp[i][0] = dp[i - 1][0]; if (i >= 2) dp[i][0] = (dp[i][0] + dp[i - 2][0]) % MOD; if (i >= 6) dp[i][0] = (dp[i][0] + dp[i - 6][0]) % MOD; dp[i][0] = (dp[i][0] + dp[i - 1][1]) % MOD; if (i >= 2) dp[i][0] = (dp[i][0] + dp[i - 2][1]) % MOD; if (i >= 6) dp[i][0] = (dp[i][0] + dp[i - 6][1]) % MOD; if (i >= 4) dp[i][1] = dp[i - 4][0]; } return (dp[n][0] + dp[n][1]) % MOD; } };

  • @ArnabBhadra02
    @ArnabBhadra02 9 днів тому

    Soln1: import math class Solution: def countTrips(self, locations): st = set() for location in locations: x = location[0] y = location[1] if x == 0 and y == 0: continue ang = math.atan2(y, x) st.add(ang) return len(st)

  • @cuckoo6676
    @cuckoo6676 10 днів тому

    is it necessary to post on linkedin?

    • @ArnabBhadra02
      @ArnabBhadra02 10 днів тому

      @@cuckoo6676 to get swag(bag) you have to post on linkedin for 80 days

  • @abhishek-negi8898
    @abhishek-negi8898 10 днів тому

    Sir if i start today gfg 160 then what problem i should solved largest second and element or mobes end to zeroes

    • @ArnabBhadra02
      @ArnabBhadra02 10 днів тому

      @@abhishek-negi8898 Solve both after entering gfg 160 And check your progress is 100% or not

  • @dharmikjain5288
    @dharmikjain5288 11 днів тому

    I have 2

  • @ArnabBhadra02
    @ArnabBhadra02 16 днів тому

    Sol3: const int OFFSET = 100000; const int MAX_VAL = 200001; vector<int> freq(MAX_VAL, 0); for(auto x: arr){ freq[x + OFFSET]++; } vector<int> duplicates; for(int i = 0; i < MAX_VAL; i++) { if(freq[i] > 1){ duplicates.push_back(i); } } if(duplicates.empty()) return 0; vector<int> have(MAX_VAL, 0); int total_need_elements = duplicates.size(); int met_need = 0; int min_len = n + 1; int left = 0; for(int right = 0; right < n; right++){ int x = arr[right] + OFFSET; if(freq[x] > 1){ have[x]++; if(have[x] == freq[x] - 1){ met_need++; } } while(met_need == total_need_elements){ min_len = min(min_len, right - left + 1); int y = arr[left] + OFFSET; if(freq[y] > 1){ have[y]--; if(have[y] < freq[y] - 1){ met_need--; } } left++; } } if(min_len <= n){ return min_len; } return 0;

  • @ArnabBhadra02
    @ArnabBhadra02 16 днів тому

    Soln2: ans = -1e15 class Solution: def f(self, i, p, mx, mn, t, A, G): global ans if len(G[i]) == 1 and G[i][0] == p: ans = max(ans, mx - mn) for j in G[i]: if j == p: continue if t == 1: mn = min(mn, mx) self.f(j, i, mx + t * A[j], mn, -1 * t, A, G) def bestNode(self, N, A, P): global ans if N == 1: return A[0] ans = -1e15 G = [[] for _ in range(N)] for i in range(1, N): P[i] -= 1 G[P[i]].append(i) G[i].append(P[i]) self.f(0, -1, A[0], 0, -1, A, G) for j in G[0]: self.f(j, 0, A[j], 0, -1, A, G) return ans

  • @drashtichag2528
    @drashtichag2528 16 днів тому

    hello

  • @shrutirai8090
    @shrutirai8090 16 днів тому

    Thanks sir please keep uploading

  • @drashtichag2528
    @drashtichag2528 16 днів тому

    ok next 2 3 and 4

  • @drashtichag2528
    @drashtichag2528 16 днів тому

    please give this github id sir

  • @ArnabBhadra02
    @ArnabBhadra02 16 днів тому

    Subscriber target 120

  • @ArnabBhadra02
    @ArnabBhadra02 16 днів тому

    Soln1: def differenceSum(self, root1, root2): # write your code here stack1 = [root1] stack2 = [root2] total_difference = 0 # Iterate while either of the stacks is not empty while stack1 or stack2: node1 = stack1.pop() if stack1 else None node2 = stack2.pop() if stack2 else None # Get the values from nodes, treating None as 0 value1 = node1.data if node1 else 0 value2 = node2.data if node2 else 0 total_difference += abs(value1 - value2) # Traverse left and right children if nodes exist if node1 or node2: if node1: stack1.append(node1.right) stack1.append(node1.left) else: # Push null nodes for maintaining traversal consistency stack1.append(None) stack1.append(None) if node2: stack2.append(node2.right) stack2.append(node2.left) else: # Push null nodes for maintaining traversal consistency stack2.append(None) stack2.append(None) return total_difference

  • @ArnabBhadra02
    @ArnabBhadra02 16 днів тому

    Soln4: class Solution: def sumOfGoodSubsequences(self, nums): MOD = int(1e9 + 7) result = 0 count = [0] * 100001 sum_of_subsequences = [0] * 100001 for num in nums: current_count = 1 current_sum = num if num > 0: current_count = (current_count + count[num - 1]) % MOD current_sum = (current_sum + sum_of_subsequences[num - 1] + count[num - 1] * num % MOD) % MOD if num < 100000: current_count = (current_count + count[num + 1]) % MOD current_sum = (current_sum + sum_of_subsequences[num + 1] + count[num + 1] * num % MOD) % MOD result = (result + current_sum) % MOD count[num] = (count[num] + current_count) % MOD sum_of_subsequences[num] = (sum_of_subsequences[num] + current_sum) % MOD return result

  • @ArnabBhadra02
    @ArnabBhadra02 16 днів тому

    Soln2: class Solution: def maxIncreasingSubarrays(self, arr): length = len(arr) inc_len = [1] * length for idx in range(length - 2, -1, -1): if arr[idx] < arr[idx + 1]: inc_len[idx] = inc_len[idx + 1] + 1 else: inc_len[idx] = 1 l, r = 1, length // 2 res = 0 while l <= r: mid = l + (r - l) // 2 if self.valid(arr, inc_len, mid): res = mid l = mid + 1 else: r = mid - 1 return res def valid(self, arr, inc_len, val): length = len(arr) for i in range(length - 2 * val + 1): if inc_len[i] >= val and inc_len[i + val] >= val: return True return False

  • @ArnabBhadra02
    @ArnabBhadra02 16 днів тому

    subscriber target 120

  • @ArnabBhadra02
    @ArnabBhadra02 16 днів тому

    Soln1: class Solution: def hasIncreasingSubarrays(self, nums: List[int], k: int) -> bool: n = len(nums) if n < 2 * k: return False for i in range(n - 2 * k + 1): first_strict = all(nums[j] < nums[j + 1] for j in range(i, i + k - 1)) if first_strict: second_strict = all(nums[j] < nums[j + 1] for j in range(i + k, i + 2 * k - 1)) if second_strict: return True return False

  • @saurabhmaurya2805
    @saurabhmaurya2805 17 днів тому

    Bhai Kitne coins pe order hua hai

    • @ArnabBhadra02
      @ArnabBhadra02 17 днів тому

      @@saurabhmaurya2805 coins nhi 24 days streak challenge se mila www.linkedin.com/posts/arnab-bhadra-110001218_geekstreak2024-geeksforgeeks-coding-activity-7255220355831607297-EPNQ?

  • @ArnabBhadra02
    @ArnabBhadra02 17 днів тому

    Soln 3: class Solution: def maxFrequency(self, nums, k, numOperations): nums.sort() left = 0 maxFrequency = 1 totalOperations = 0 for right in range(1, len(nums)): totalOperations += (nums[right] - nums[right - 1]) * (right - left) while totalOperations > numOperations: totalOperations -= nums[right] - nums[left] left += 1 maxFrequency = max(maxFrequency, right - left + 1) return maxFrequency

  • @ArnabBhadra02
    @ArnabBhadra02 17 днів тому

    soln2: class Solution { public: int maxFrequency(vector<int>& nums, int k, int numOperations) { int max_num = *max_element(nums.begin(), nums.end()); int size = max_num + k + 2; vector<int> freq(size, 0); for (int num : nums) { freq[num]++; } vector<int> pre(size, 0); pre[0] = freq[0]; for (int i = 1; i < size; ++i) { pre[i] = pre[i - 1] + freq[i]; } int result = 0; for (int x = 0; x < size; ++x) { if (freq[x] == 0 && numOperations == 0) { continue; } int left = max(0, x - k); int right = min(size - 1, x + k); int totalInRange = pre[right] - (left > 0 ? pre[left - 1] : 0); int canAdjust = totalInRange - freq[x]; int total = freq[x] + min(numOperations, canAdjust); result = max(result, total); } return result; } };

  • @ArnabBhadra02
    @ArnabBhadra02 17 днів тому

    Subscribers target 120

  • @ArnabBhadra02
    @ArnabBhadra02 17 днів тому

    Soln 1: class Solution: def smallestNumber(self, n: int, t: int) -> int: def digit_product(x): product = 1 for digit in str(x): if int(digit) > 0: product *= int(digit) return product while True: if digit_product(n) % t == 0: return n n += 1

  • @madhurya6417
    @madhurya6417 23 дні тому

    Thank you sir.. They are working

  • @ArnabBhadra02
    @ArnabBhadra02 23 дні тому

    Requesting all to subscribe my channel ❤ I will try to upload today's gfg contest solution also

  • @SRIHARSHAVARTHMIT
    @SRIHARSHAVARTHMIT 23 дні тому

    pls give sol2 and sol 3 is not working

  • @ArnabBhadra02
    @ArnabBhadra02 23 дні тому

    Soln: import heapq class Solution: def minTimeToReach(self, move_time): rows = len(move_time) cols = len(move_time[0]) distances = [[float('inf')] * cols for _ in range(rows)] priority_queue = [] heapq.heappush(priority_queue, (0, 0, 0)) distances[0][0] = 0 directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] while priority_queue: curr_time, curr_row, curr_col = heapq.heappop(priority_queue) if curr_time > distances[curr_row][curr_col]: continue for dr, dc in directions: new_row, new_col = curr_row + dr, curr_col + dc if 0 <= new_row < rows and 0 <= new_col < cols: new_time = max(curr_time, move_time[new_row][new_col]) + 1 if new_time < distances[new_row][new_col]: distances[new_row][new_col] = new_time heapq.heappush(priority_queue, (new_time, new_row, new_col)) return distances[rows - 1][cols - 1]

  • @nottyarmy
    @nottyarmy 23 дні тому

    Sir kindly solve it in C++

    • @ArnabBhadra02
      @ArnabBhadra02 23 дні тому

      try to convert into your preferred lang

  • @ArnabBhadra02
    @ArnabBhadra02 23 дні тому

    Soln1: class Solution: def isBalanced(self, num: str) -> bool: sum1 = 0 sum2 = 0 for i in range(len(num)): c = int(num[i]) if i % 2 == 0: sum1 += c else: sum2 += c return sum1 == sum2