count = diff[i] % 26 will not result in a negative value as I understand. So is the condition if count < 0 required? -2 % 26 = 24 > 0 2 % 26 = 2 > 0 So it seems this will never be negative. My submission without the condition was also accepted.
(k%26) + 26 is always equal to (k%26) when we use %26 again right? I can't understand this for decrement can any one explain? for negative values like -2 , -2 mod 26 is 24 right we are adding 26 to it and again we are doing mod operation at last which is same as 24 right? I am a bit confused here
In java /C++ -2%26 is not 24 its actually -2 so, 2 steps backward equals to 24 steps forward In python -2%26 returns 24 , In python it actually returns correctly. So In java / C++ 1)-2%26 = -2 2)-2+26 = 24 3)24%26 = 24 =>same In python 1)-2%26 = 24 2)24 + 26 = 50 3)50%26 = 24 =>same Here is the reason
Hi teacher, thank a lots for your explanation.I have a bit confuse a bout diff array: In the Difference array video below, you give an example a bout stock array and you said that we have compute the difference between the ith element and (i-1)th element.There is nothing to wonder in Difference array problem because all of element is equal zero, so we can initial a zero array.But in this problem, every character have difference ascii code, so i wonder why you initial array contains all zero instead of difference between their ascii code?Please explain clearly for me.Have a good day
You can start with all 0s and just record increase & decrease so that at the end, You can just review the gradient and get the actual increment. I think ASCII was not recorded when diff array was defined. The default is 0
Great video, Learnt about difference array from your channel to solve this problem!!!
nice
Thank you so much for teaching this technique sir!
You’re welcome! 😄
New pattern nice to remember Thank you very much for the efforts. I always jump into yours as 1st preference.
Thanks for the support! 😄
Thank you bro. you are great, i learned lot of new things from you 😇😇Love you brother
Thanks for the love! 😄
Both videos are well explained thank you this pattern stick to my head.
Glad you found it helpful!
Thank you sir !
welcome
count = diff[i] % 26 will not result in a negative value as I understand. So is the condition if count < 0 required?
-2 % 26 = 24 > 0
2 % 26 = 2 > 0
So it seems this will never be negative.
My submission without the condition was also accepted.
It may be language dependent.
In your languague & version it would work as you said.
But may not be true for all :)
Excellent Explaination
Glad it was helpful!
thanks sir
welcome :)
(k%26) + 26 is always equal to (k%26) when we use %26 again right? I can't understand this for decrement can any one explain? for negative values like -2 , -2 mod 26 is 24 right we are adding 26 to it and again we are doing mod operation at last which is same as 24 right? I am a bit confused here
In java /C++
-2%26 is not 24 its actually -2 so, 2 steps backward equals to 24 steps forward
In python
-2%26 returns 24 , In python it actually returns correctly.
So In java / C++
1)-2%26 = -2
2)-2+26 = 24
3)24%26 = 24 =>same
In python
1)-2%26 = 24
2)24 + 26 = 50
3)50%26 = 24 =>same
Here is the reason
@vkireetichandan747 oh thanks I thought the above is for all languages now I get it
Great Video , Thanks.
welcome :)
can you share me the link to understand difference array concept?
It is in the description and also in i button in top right
Hi teacher, thank a lots for your explanation.I have a bit confuse a bout diff array: In the Difference array video below, you give an example a bout stock array and you said that we have compute the difference between the ith element and (i-1)th element.There is nothing to wonder in Difference array problem because all of element is equal zero, so we can initial a zero array.But in this problem, every character have difference ascii code, so i wonder why you initial array contains all zero instead of difference between their ascii code?Please explain clearly for me.Have a good day
You can start with all 0s and just record increase & decrease so that at the end, You can just review the gradient and get the actual increment.
I think ASCII was not recorded when diff array was defined.
The default is 0
Thank you sir :)
Most welcome!
Just a suggestion, try to also give solutions in Python, a lot more viewers will be interested, Thanks.
Solutions are added in Python too along with CPP & JAVA
10:20 why incremented by +1
Thats the logic of Range update.
Please watch difference array video again.
We are decrementing hence we add.
if we increment then we subtract.
Bro I am a regular viewer of your content, and unfortunately too many ads show up during the entire video. Too much ad creates distraction....
RUclips :(
@@techdose4u He meant inside video
@@nikhil_squats 😄
use brave browser then no ads no ads all over website
use brave browser
Sir ye code toh chal hi nhi rha h
which language?
gives the wrong answer check your solution
Sometimes languague conversion creates some glitch in other languagues.
z hota h G nhi, please yaar aur complicate mat kr ye sb bol k
its translated as Zee in american english.
couldnt keep track of countrywise english if you don’t mind :)