Alternative deleteHead approach. Is it correct?

yes this approach is absolutely correct

if you want to ask something about this feel free to ask
i hope this helps
if yes show your response with :heart: and don’t forgot to mark doubt as resolved