coded solution
small note