Matrix keyboard and 7segment display countdown combination
Try using millis(), it returns the number of milliseconds passed since the Arduino board began running the current program.

When you start the countdown you set a variable for a beginning time  

int millisBegin = millis(); //put this at the end of your setup() {}. 

You will also need a "border" to know when one second is over, so 

int millisBorder = 1000; //one second border

Every time your the loop() {} starts over you can check if one second has passed so far

int millisNow = millis();
if(millisNow - millisBegin &gt;= millisBorder){} //if one second over, do {}


Now I would work on the segment showing thingy. In the {} I would put a new variable, let's call it counter = 4; //4 because I found 3 numbers in your sketch. Every time the if() {} is being executed, you go through more if () {} statements, checking what number to display next.

if (counter == 3)
{
  //show number 3
}

if (counter == 2)
{
  //show number 2
}

if (counter == 1)
{
  //show number 1
}

if (counter == 0)
{
  //show number 0
}
counter = counter - 1;


At the end we take one off the counter, so the next time we enter the if(one second over) the number displayed will get lower

And well now there are multiple ways of doing the keyboard thingy. You can keep checking if there is a key available, and if so you can safe it as a String (most people hate strings, but I never had a problem with them to be honest).

After you've saved the key as a String you can use the strcmp(); method to compare the string with the solution/answer strcmp(key,answer);. If the key and the answer are the same, it will return 1.

if(strcmp(key,answer) == 1)
{
  Serial.println("you made it");
}