The first card, 2D, relays the suit of the 5th card, diamonds, and a 'base number' 2.
The remaining three cards can be passed in six different orders, allowing any number from 1 to 6 to be generated.
4C, 5H, KS = 1; 4C, KS, 5H = 2; 5H, 4C, KS = 3; 5H, KS, 4C = 4; KS, 4C, 5H = 5; KS, 5H, 4C = 6.
The number, 3 for the example given, is then added to the base number to identify the fifth card.