how the ampersand left shift trick works is & finds where there is 1 and 1 (the only case that results in carry) and places a 1 to mark the carry, the leftshift applies the carry to the next bit
Hey Gregg I wanted To ask you for a favour Please make A Video On timeseries Dataset Multivariate with Implementation of PCA-LSTM hybrid approach On It
I guess the point is to walk through the code and realize that the greedy part is to get all the carriers in one operation. Somehow, the final result matches the correct result. It is hard to prove it wrong mathematically or find a counter-example. A greedy approach, for example, replacing a queue with a priority queue appears in hard problems. I think that the good side in this context is to introduce multi-threading, like multiple threads can get the targets all at once. People usually will not do bit-manipulations a lot. So, that part is exercised. I actually would prefer to see the codes that perform additions concurrently because it aligns with maths. 10^4 does not require greedy approaches most of the time. Clearly, the idea of a greedy approach is harder than DP. Straightforwardly, DP is to list all possible cases by trees, just like a nested for loop, which is actually not needed in the first problem.
Hey thank you. Can you upload more videos on DSA with python. It's really helping me since I'm currently a computer science engineering student and on my way to become a data scientist.
sir, i am from bangladesh . i am only 16 years old. i have learned c and learning c++.i dream to work in fang companny .what would be my roadmap ? i kindda suck at solving problem but i try. please help me , you are my insperation 😊😊
Master Data Structures & Algorithms for FREE at AlgoMap.io/
Great video! For those of us who used to do assembler, it was a nice trip down memory lane!
how the ampersand left shift trick works is & finds where there is 1 and 1 (the only case that results in carry) and places a 1 to mark the carry, the leftshift applies the carry to the next bit
Hi sir, from Nigeria, really enjoy watching your videos, wanted to make a request for LRU cache
On which editor you are explaining sir?
What language do you think is better for dsa... python or java for future?
C++
Java
Hey gregg! It's time you update the list with some hard level problems or maybe create a new tab and put some hards in them :)
Hey Gregg I wanted To ask you for a favour Please make A Video On timeseries Dataset Multivariate with Implementation of PCA-LSTM hybrid approach On It
hI CAN YOU GIVE TIPS HOW TO MASTER ATBACKTRACKIGN PROBLEMS?
The solution is invalid. String b can be very large and exceed the capacity of an integer.
I guess the point is to walk through the code and realize that the greedy part is to get all the carriers in one operation. Somehow, the final result matches the correct result. It is hard to prove it wrong mathematically or find a counter-example. A greedy approach, for example, replacing a queue with a priority queue appears in hard problems.
I think that the good side in this context is to introduce multi-threading, like multiple threads can get the targets all at once. People usually will not do bit-manipulations a lot. So, that part is exercised. I actually would prefer to see the codes that perform additions concurrently because it aligns with maths.
10^4 does not require greedy approaches most of the time. Clearly, the idea of a greedy approach is harder than DP. Straightforwardly, DP is to list all possible cases by trees, just like a nested for loop, which is actually not needed in the first problem.
What the...
How do you deal with overflow of the variable `carry`?
``` cpp[]
string addBinary(string a, string b) {
if (a.size() < b.size()) {
return addBinary(b, a);
}
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
bool carry = false;
string s = "";
for (int i = 0; i < a.size(); ++i) {
bool aa = a[i] == '1';
bool bb = i < b.size() ? b[i] == '1' : false;
char digit = '0' + (aa ^ bb ^ carry);
s += digit;
carry = (carry & (aa | bb)) | (aa & bb);
}
if (carry) {
s += '1';
}
reverse(s.begin(), s.end());
return s;
}
```
Hello my name is Otabek. I am from Uzbekistan. I am 15 years old.I am going to be member of IOI. But I don't understand DSA.Please help me ?
Give me roadmap please ?!
Hey thank you. Can you upload more videos on DSA with python. It's really helping me since I'm currently a computer science engineering student and on my way to become a data scientist.
Can't we just simply do:
final=bin(int(a,2)+int(b,2))[2:]
return final
what the
sir, i am from bangladesh . i am only 16 years old. i have learned c and learning c++.i dream to work in fang companny .what would be my roadmap ? i kindda suck at solving problem but i try. please help me , you are my insperation 😊😊
algomap.io