3234. Count the Number of Substrings With Dominant Ones | Weekly Leetcode 408

  Рет қаралды 4,332

codingMohan

codingMohan

Күн бұрын

Пікірлер: 14
@vishnu4647
@vishnu4647 Ай бұрын
please always try to upload last two problems of the contest. thanx
@nikhilsoni2403
@nikhilsoni2403 Ай бұрын
Today, i was not able to relate this problem to any of the previous problems i have solved.. What should i do in such situations, when i encouter a new kind of problem? Or is grinding a lot of problems the only way ?
@acxd
@acxd Ай бұрын
Kafi accha explanation hai bhai
@cosmicboy588
@cosmicboy588 Ай бұрын
Can you bring any series on Combinatorics like you did for segment tree it would be really helpful
@priyanshkumar17
@priyanshkumar17 Ай бұрын
Thanks for this video !!! Please make for the 4th problem as well.
@codingmohan
@codingmohan Ай бұрын
Here you go - kzbin.info/www/bejne/hJS0oaVmZbZ0h7c
@23cash86
@23cash86 Ай бұрын
Wonderful explanation
@nikhilsoni2403
@nikhilsoni2403 Ай бұрын
Thank you !! ❤😊
@justsomeguywithoutamustach9978
@justsomeguywithoutamustach9978 Ай бұрын
i dont get why for a valid substring, the maximum number of zeroes can be root(n). Let's say number of zeroes = x, ones = y, length = n; => x + y = n now, since the string is valid, y >= x^2 => maximum of x can be y^0.5 now as you said, maximum of x = root(n) then, y = n - x = n - root(n); but now, the condition y >= x^2 becomes y >= n => n - root(n) >= n which is not possible... can you help me with this?
@codingmohan
@codingmohan Ай бұрын
If X + Y = N --> then X can never be root(N), it will be less than root(N). Hence the inference is correct - but you should check it for a smaller X than root(N). in that case your inference would take a form like - Y = n - (root(n) - c) => n - root(n) + c >= n + c*c - 2*root(n)*c And the above equation is always true for some inequality of "c" and "n". In other words, the # of zeros will be smaller than root(n) always (not equal to root n). Another "easy" way to visualise this is that if you have greater than root(n) zeroes, you'll require ">= N" ones, which is not feasible.
@veerajbachche1064
@veerajbachche1064 Ай бұрын
@@codingmohan Even if we take root(no of ones in a string) and iterate that much zeros it will be fine .
@ok-google-run
@ok-google-run Ай бұрын
So this gives us an assumption that no. of zeroes in the whole string is not going to be more than (root n). But what if we have zeroes more than (root n) but they are not considered in as a valid string. So even if they are not considered as valid strings, we have to iterate and that makes it n ^ n right? Am I thinking wrongly ? Please correct me if so
@mr.m4884
@mr.m4884 Ай бұрын
good boy 🐕‍🦺🐕‍🦺
2949. Count Beautiful Substrings II |  Weekly Leetcode 373
38:49
codingMohan
Рет қаралды 1,6 М.
Люблю детей 💕💕💕🥰 #aminkavitaminka #aminokka #miminka #дети
00:24
Аминка Витаминка
Рет қаралды 1,3 МЛН
Nurse's Mission: Bringing Joy to Young Lives #shorts
00:17
Fabiosa Stories
Рет қаралды 16 МЛН
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 3,7 МЛН
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 265 М.
3267. Count Almost Equal Pairs II | Weekly Leetcode 412
24:19
Dynamic Programming Mindset for Codeforces ft. CF2003F
17:44
The LeetCode Fallacy
6:08
NeetCode
Рет қаралды 496 М.
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Codebagel
Рет қаралды 204 М.
Bresenham's Line Algorithm - Demystified Step by Step
16:10
NoBS Code
Рет қаралды 36 М.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 85 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 648 М.
Люблю детей 💕💕💕🥰 #aminkavitaminka #aminokka #miminka #дети
00:24
Аминка Витаминка
Рет қаралды 1,3 МЛН