According to this take, Shadow is the smarter of the two. While both are quick-witted in their own ways, Shadow is often portrayed as more calculating and strategic.
Sonic relies heavily on instinct and speed, whereas Shadow tends to think several steps ahead. So if it comes down to pure cleverness, Shadow gets the edge here.