1. A method for detecting hotspots in semiconductor wafer, comprising: inspecting at least one semiconductor wafer to detect a plurality of hotspots of each die in the semiconductor wafer, wherein each of the hotspots has defect coordinates in a layout of the die; stacking the hotspots of the dies in the layout according to the defect coordinates of the hotspots; obtaining a common pattern according to the stacked hotspots corresponding to a location with specific coordinates in the layout; determining whether the common pattern is a known pattern having an individual identification (ID) code; and assigning a new ID code to the common pattern when the common pattern is an unknown pattern.