We first recommend you to confirm if the mail you received regarding unauthorized access of your account is genuine or fake. To do this, you can use "Recent Login Activity" feature of Yahoo to check who all have signed in to your account. To use this feature, you can refer to the instructions on the following Yahoo page:
You can also cross-check some more details to make sure that your account was hacked. To know what all details to check, you can refer to the following Yahoo page:
If you are sure that your account has been compromised, you need to take some immediate steps to secure it. To understand what all steps to take, you can refer to the following Yahoo page:
Also, update your security software and scan your system thoroughly to detect and remove infections, if any. You can also use Malwarebytes anti-malware to detect and remove malware effectively. To download Malwarebytes, refer to the link below:
Hope this will resolve your issue.