Like @jlb, I'd prefer books to YouTube videos any day. (The only YouTube video I have ever found remotely "useful" - as opposed to entertaining - was a manufacturer's video on how to replace the door on a particular washing machine: c++ can do many things, but not that - yet).
Practice by writing code - depends what your background is, but if you are a university student in maths, science or engineering there are plenty of examples.
Look at other people's code ... e.g. in this forum.
Strangely, I found it useful to consider ... I can do this in programming language X, how do I do it in C++? Obviously requires previous programming experience in some language.
Look at other people's code ... e.g. in this forum.
I spend a lot of time reading others' questions and seeing the code people provide to help. Many people provide code examples that I first scratch my head over, then I test it out. While looking at references that give more depth to the algorithm or language feature. Lots more samples to test.
Eventually I get my brain wrapped around the concept.