A. I got lost when I came here the first time.
B. I got lost when I came here for the first time.
Which one is correct? Or is there any semantic difference between them?
A. I got lost when I came here the first time.
B. I got lost when I came here for the first time.
Which one is correct? Or is there any semantic difference between them?
I guess both are correct, and their meaning is the same, or largely the same. I don't notice any difference.
The first sentence may sound a bit less formal.
Strangely, when I reword the sentence, I feel the need for the preposition:
Coming here for the first time, I got lost.
But maybe here it is also okay to drop the preposition.
From the grammar standpoint, "for the first time" is an adverbial prepositional phrase: it modifies the verb to come as a adverb would do. It serves as an "adverbial complement to the verb came" (in your example sentence).