#119
Вставка
- Опубліковано 28 тра 2024
- 🚀 Solving Geeks for Geeks Problem of the Day(POTD) in C++ | Sum of Products | Intuition Explained🧠
Problem Statement : www.geeksforgeeks.org/problem...
Solution Code : github.com/Masked-coder11/gfg...
Count-inversion: • Love Babar DSA sheet |...
Count-inversion code:github.com/Masked-coder11/Lov...
🌐 Connect with Me:
GitHub: github.com/Masked-coder11
Instagram: garg.yugayu...
Linkedin: www.linkedin.com/in/yugayu-garg-47a001225
Join my discord Server: / discord
💬 Have questions or suggestions? Drop them in the comments below! Let's learn and grow together. Happy coding! 👨💻
#GFG #POTD #geeksforgeeks #problemoftheday #c++
could you please explain why are we left shifting corresponding to the index value like 1
This is done so as to add the number of pairs at that particular set bit
@@maskedcoder-dy1ubCould you elaborate with an example
Great explanation!
Glad it was helpful!
ans+= (1
Yes 2^i will also work
Is it not working??
@@maskedcoder-dy1ub (2^i) it is (2xor with i) not the 2 to the power i
@@rajasthaniboy888 bro he means 2**i.....1
I meant power
@@maskedcoder-dy1ub yes that is working, 2 raised to the power i,
my doubt is why are we multiplying with this in the first place...
sorry to say that today video was not helpful for me even i did not get the concept , i watched this video three time🙃
Oh! Sorry to hear that
Like can you pinpoint where did you faced difficulty, maybe I can explain you
In the second optimal approach, the step when u start left shifting and the whole part after shifting I didn't understand
See at any bit what is the number getting added:-> the number of pairs of set bits because we have been given bitwise and sums.
now to add anything at any but we will have to multiply by (1