Even if it is obvious, I see juniors doing this a lot. It happens fast if you're deep into solving a challenge. Take your time and have a second look at every piece of code you wrote.
It doesn't seem like a big deal, but if your codebase grows and performance gets a critical point in your application this small mistakes add up quickly.
Never do repetive heavy calculations in frequently called code (eg loops).
Of course only if the input to the heavy method isn't changing.