Here's how:
Noun:
* "I solved the puzzle." Here, "puzzle" refers to the game or problem itself.
Adjective:
* "That was a puzzle to me." Here, "puzzle" describes something as being confusing or perplexing.
So, the part of speech depends on how it's used in the sentence.