Let O = Odd Digit
and E = Even Digit
We have 5 odd digits {1,3,5,7,9} and 5 even digits {0,2,4,6,8}
These are the possible combination where no two even digits are adjacent
Possible combination of codes starting with an odd digit
OOOO - 5*5*5*5 = 5^4
OEOO - 5*5*5*5 = 5^4
OOEO - 5*5*5*5 = 5^4
OOOE - 5*5*5*5 = 5^4
OEOE - 5*5*5*5 = 5^4
Possible combination of codes starting with an even digit
EOOO - 5*5*5*5 = 5^4 (not 4*5*5*5 as 0 can be the first digit)
EOEO - 5*5*5*5 = 5^4
EOOE - 5*5*5*5 = 5^4
The only mistake piyush did was that he thought 0 cant be used as the first digit. But actually we can use 0 as the first digit because here what we are looking for is a lock combination and not a normal math number.
Imagine you have a briefcase and you have to use a four digit lock code to open it. Here you can set the first digit 0 in your combination. So in this scenario 0975 is a four digit lock code, not a 3 digit one.
when you add up all the possible combination that i have listed above to get the total possible combination, you get 8(5^4)
HTH..