Could anybody explain testcase #4 without giving any hints? Testcase #4 is where the input is 15 and the expected result is 7.

In testcase #4 input is 15 so suppose our 1st rainbow no is 123456777654321. We see here total three 7 exists. so we can make 7 rainbow no by changing all nos. like

123456676654321

123455676554321

123445676544321

123345676543321

122345676543221

112345676543211

total six and 1st no was 123456777654321 means total 7 nos.

so output is 7.

1 Like