0

According to an example (https://algorithms.tutorialhorizon.com/colorful-numbers/) :

Given Number : 3245 Output : Colorful Number 3245 can be broken into parts like 3 2 4 5 32 24 45 324 245. this number is a colorful number, since product of every digit of a sub-sequence are different. That is, 3 2 4 5 (3*2)=6 (2*4)=8 (4*5)=20, (3*2*4)= 24 (2*4*5)= 40

Given Number : 326 Output : Not Colorful. 326 is not a colorful number as it generates 3 2 6 (3*2)=6 (2*6)=12.

It doesn't make sense. What am I missing? It says that PRODUCT of EVERY DIGIT of a SUBSET is DIFFERENT.

But the products for the subsets of 326 are also different since they equal 6 and 12 (as shown in the example above). And 6 != 12.

Hopefully somebody can explain this like I'm 5 to me.

  • 1
    You should state a definition of colorful. What is ELI5? It reads like explain. We are more formal than that here. "But the products for 326 are also different since 6 and 12." is not a sentence and I don't understand what you are trying to say. – Ross Millikan Oct 16 '18 at 03:45
  • My Apology. ELI5 = Explain like I'm 5. – cocoonkid Oct 16 '18 at 03:47
  • 1
    6 is also the product of a 1-element subset. To elaborate: In the 3245 case, all nine products are different. In the 326 case, there are five products: 3, 2, 6, 6, 12, of which two are the same. –  Oct 16 '18 at 03:48
  • So I assume that the example should be more detailed and mention all nine and five products ? Then it would indeed make immediate sense to me. – cocoonkid Oct 16 '18 at 03:56
  • I would love to post a definition of colorful numbers but I am not able to find one which is strange in itself. – cocoonkid Oct 16 '18 at 04:00
  • They are already listed right there in your question. "326 is not a colorful number as it generates 3 2 6 (3*2) = 6 (2*6) = 12." (emphasis added) –  Oct 16 '18 at 04:01

1 Answers1

1

You have missed the fact that $6$ is a substring of $326$ and $6=3\cdot 2$ as Rahul says. I think that is an answer, so I posted it CW.

Ross Millikan
  • 374,822