Alice and Bob started working part-time parking lot attendants. Bob was managing a car when Alice arrived late on the first day at work.

A: I'm sorry for being late. How many cars have come in?

B: I will make a quiz on it. Why don't you guess the number of cars?

A: You are giving me a problem to solve?

B: Right. Every car has its plate number and the numbers have special relation.

A: So, do you want me to figure out the number of cars from that relation?

B: Yes, conditions are as follows.

Condition 1: Any two cars must share only one digit.

Condition 2: There must be exactly one more car with the equal digit that two cars have.

A: (after thinking) Three cars?

B: Why do you think the answer is three cars?

A: For example, if there are three cars with the plate numbers 1, 12, and 13, any two cars have 1, and there are exactly three cars which has 1 in the plate number.

B: Oh, there is one more condition.

Condition 3: There are more than three cars.

How many cars were in the parking lot when Alice arrived?

Added remark: It's not very hard to construct examples for 7 cars. Could you show the reason why other number cannot be an answer?

  • $\begingroup$ do all cars have 4 digits? $\endgroup$
    – Ivo
    Jan 26, 2015 at 13:14
  • $\begingroup$ @IvoBeckers Sorry. Any number of digits. $\endgroup$
    – P.-S. Park
    Jan 26, 2015 at 13:17
  • 1
    $\begingroup$ I think the conditions are unclear. Wouldn't adding 1114 to the other three be correct? or 1115 to that? $\endgroup$
    – Ivo
    Jan 26, 2015 at 13:20
  • $\begingroup$ If two cars (1111 and 1112) have a digit 1 in common, there is only one more car having a digit 1. So neither 1114 nor 1115 exists. $\endgroup$
    – P.-S. Park
    Jan 26, 2015 at 13:23
  • 1
    $\begingroup$ It's a trick question. Mallory was there, and she intercepted Bob's messages, and sent modified conditions to Alice without either of them knowing. $\endgroup$
    – KSmarts
    Jan 26, 2015 at 21:50

3 Answers 3


If any two cars share exactly 1 digit, we can get up to $7 cars$:

Based on our restrictions, we can use at most 30 digits. A 3-digit number can match at most 6 other numbers (2 for each digit). A 4-digit number can match at most 8 other numbers, but at that point, we need more than the 30 available digits.

1__'s then 2__'s then 3__'s
$123, 145, 167, 246, 257, 347, 356$


Starting from 12, 13, 14
$125, 136, 147, 234, 267, 537, 564$


So, if I have it right:

  • Any two cars share at least 1 digit
  • 1 and only 1 other car shares that digit

So, it looks like we need some sort of groups of 3.

Might be able to get away with 5 cars: 12, 13, 14, 234, 432

  • $\begingroup$ Sorry for my poor English. Any two cars should share only one digit. In your answer, 234 and 432 share three digits. $\endgroup$
    – P.-S. Park
    Jan 26, 2015 at 14:33
  • $\begingroup$ I think I'm missing something. Can you explain the "30 digit" limitation? $\endgroup$
    – Nick2253
    Jan 26, 2015 at 17:52
  • $\begingroup$ Each digit can at most be used 3 times. That's because if there is ever a pair of those digits, there must be 1 (and only 1) more. Since there are 10 total digits, 30 is the max. $\endgroup$
    – JonTheMon
    Jan 26, 2015 at 19:00

7 cars

Example with 7 cars: 156 267 137 124 235 346 457

  • $\begingroup$ Good! But, your second example is not correct: 124 and 568 share no digits. $\endgroup$
    – P.-S. Park
    Jan 26, 2015 at 14:42
  • $\begingroup$ yeah you're right. guess 7 is the only option then :) I'll edit it $\endgroup$
    – Ivo
    Jan 26, 2015 at 14:42

ORIGINAL ANSWER before question was ammended: I'm having trouble understanding the clauses ... doesn't

Condition 1: Any two cars must have an equal digit. Condition 2: There must be exactly one more car with the equal digit that two cars have.

Just mean that that there must be 3 cars that share a digit?

In which case the answer is 4:

12, 13, 23, 123

Each digit is shared by two cars, plus exactly one more car.

EDITED ANSWER: 7, if only a single digit can be shared between two cars.

2, 3, 4, 12, 13, 14, 234

  • $\begingroup$ FYI, OP edited just after you posted to change condition 1 to "Any two cars must share only one digit." This sounds correct for the original wording. $\endgroup$
    – Set Big O
    Jan 26, 2015 at 14:34
  • $\begingroup$ Sorry for my poor English. Your answer shows that 23 and 123 share two digits. $\endgroup$
    – P.-S. Park
    Jan 26, 2015 at 14:34
  • $\begingroup$ your edited answer has 4 times 1 $\endgroup$
    – Ivo
    Jan 26, 2015 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.