There are several methods which can be used to drive large numbers of LEDs from a few IO pins.
The simplest is standard row/column display multiplexing. With this technique, you can drive \$( n / 2 )^2\$ LEDs with \$n\$ IO pins. Mathematically, the duty cycle is:
$$\frac{1}{minimum(\text{unique row patterns, unique column patterns})}$$
This means that this technique has a duty cycle of 100% when all LEDs are lit (or all rows or all columns are identical) and a duty cycle of \$1 / n\$ when a diagonal line needs to be lit (or all the rows are different). You're only guaranteed 100% duty cycle when lighting every LED or one LED (or zero LEDs, but that doesn't really count for much).
Slightly more complex is Charlieplexing. With this technique, you can drive \$n^2 - n\$ LEDs with \$n\$ IO pins. Only \$n - 1\$ LEDs can be lit simultaneously with this technique. Mathematically, the duty cycle is:
$$\frac{1}{\text{minimum simultaneous sets}}$$
where a simultaneous set is a unique group of LEDs which has a common anode or common cathode. (This hasn't been proven, it's just what I arrived at after pondering the problem for a minute. If duty cycle is important to you, you'll want to look into this further.) This is a much more complex calculation both intellectually and computationally than the equivalent calculation for standard multiplexing. Effectively, you get a duty cycle of \$1 / n\$ when all LEDs are lit but some (only some) patterns of n-1 or fewer LEDs can have a duty cycle of 100%. You're only guaranteed 100% duty cycle when lighting 1 LED.
The last method I'll mention is to use a shift register or IO expander. With two pins (Either the raw data/clock interface, I2C, or unidirectional SPI), you can control an arbitrarily large number of LEDs. The duty cycle for any pattern is 100%, but the update rate is inversely proportional to the number of LEDs. This is the most costly method. For 15 LEDs, it will probably be cheaper to just upgrade to a micro with that many IO pins.
There's a bunch of LED driver ICs, for instance TLC5951DAP. See it in use here:
Mbled
Similar problems has been solved in a few open source projects, like Peggy2.
The chip Peggy2 is using seems to be going out of production, MBI5026 might be a replacement.
Best Answer
8 leds on/off have 2^8 = 256 possible states
5 control pins on/off have 2^5 = 32 possible states
Since 32 < 256, and you can't use shift registers or i/o expanders, it would be impossible...
But if the 5 control pins are the pins of a MCU, you need to use only one of them for controling the 4 * 2 multiplexing process. One of the pins can be 0V or +Vcc, each of these two states enables a different set of 4 LEDs attached to the other 4 pins.
"he gave us a hint : use a wire connection combination if a problem appears try solving it in your code"
As this is a theoretical question in a curse, I think that this would be a possible correct answer. This is a kind of 2*4 multiplexing, using only 5 pins.
If you need to control a higher number of LED's, charlieplexing would allow to control untill 20 LED's.
simulate this circuit – Schematic created using CircuitLab