So on that 2nd picture, you have an array of strings. Make them an array of integers, the actual numbers we are going to check against, not the alphabetic-characters, ‘24’, etc.
You will make a second array of integers, 6 long. When someone clicks on a key, you take the 5th slot and move it to the 6th slot. Take the 4th slot and move it to the 5th slot, the 3rd to the 4th, etc. And the new key takes the 1st slot. This is a queue, like a line of people at the supermarket. When you press a key, add a customer, they go to the end of the line. The order is arbitrary, if we add to the head, or the tail, but in this case we are adding to the head, so slot 1 is the last-key pressed and slot 6 is the 1st key pressed. The idea is we only need to hold the last 6, so we pick a ‘side’ and fill it from there.
Every-time you do that, you press a key and add it to the queue, you compare the combination-array to the key’s-pressed array. Just make sure you account for the order they are each stored in.
Key by key, if the input does NOT match the corresponding key for the combo, then the key pressed is incorrect, so you can just do nothing, drop out of testing. If the key, DOES match, test the next key, then repeat.
If you make it to the end, they pressed the the keys in the correct order.