My roadblocks to doing this would be that I wouldn't be able to pay attention to what's going on while thinking about a homework problem, that some things need to turn over in my head before I understand it at the level needed to apply it, and that solutions often take a long time to type up, especially proofs and programming assignments.
Of course whether I finish the exercises before the lecture completes really depends on the course. If it is implementing a simple algorithm and devising some test cases for it then it is often the case. If it is implementing an ML algorithm over a large data set, of course not.
Also I have been working in open offices for a long time, so I have learned to focus when there is a lot of background noise. I usually do not start paying attention to the lectures unless it sounds like there is a good joke, or I am getting stuck doing the exercises.
I also do not actually watch the lectures, I only listen to them unless I get stuck in the exercises.
If there are videos I listen to them while I am doing the homework associated with the video, but usually I get the homework done before the video finishes.
Disclaimer: I can probably get away with this because I already have a PhD and so I have a lot of practice in learning things