Yes, this code is optimal and correct as per the frontend mentor's description.
You need to be logged in before you can do that.