A well-known idiom says that great minds think alike. It’s what we say when two people think of the same great idea at the same time. History is full of examples that reaffirm the claim that great minds think alike, with discoveries and inventions like the jet engine and the theory of evolution being made at roughly the same time by different people. However, this idiom is interesting to us for an entirely different reason.
When you say that all great minds think alike, you are using “alike” correctly. Being an adverb, “alike” is used to modify the verb that precedes it, in this case “think.” A common misuse of “alike” is when we use it as an adjective, as in this sentence:
The two scientists had alike ideas about the Big Bang.
In that sentence, we were trying to modify the noun “ideas.” By using “alike” instead of an adjective, we effectively modified the verb in the sentence—“had.” If we were to rewrite the sentence correctly, we would have to say:
The two scientists had similar ideas about the Big Bang.
The two scientists had the same ideas about the Big Bang.
So now that we know that “alike” is an adverb and that it should be used to modify verbs. Just as it’s common to incorrectly use “alike” when we should be using the adjective “same,” it’s also common to make a mistake the other way around and use “same” as an adverb when we should be using “alike”:
All great minds think the same.
Because “same” is an adjective and not an adverb, in this sentence it could only modify “all great minds.” But since we want to point out that their thinking is similar, not the minds themselves, we say that they think alike. But we could add a noun for the adjective “same” to modify and make the sentence work:
All great minds think the same thing.
This sentence might not be true, but it’s grammatically correct, with “same” being used as an adjective which modifies the noun “thing.”
from Grammarly Blog https://www.grammarly.com/blog/2016/how-to-use-alike-and-same-correctly/