If it's the Windows password, then a boot disc such as Hirens should be able to sort it. (Though I'd personally just reinstall Windows.)
However, if it's the BIOS password, the solution isn't as simple. You are going to need to see if there is a BIOS password calculator available for the laptop you've bought. If not, you are probably looking at needing to pay for someone to unlock it. If you bought the laptop from eBay, or other site with buyer protection, see if you can get a refund.