Please help me with the approach of this qstn
Finding cb numbers
Hello @dbhavanishankar89,
-
There is no need of calculating primes:
you can directly create an array and initialize it with the CB numbers given in the question.
i.e. 2,3,5,7,11,13,17,19,23,29 -
Make an array visited[n], to mark the indexes as visited (i.e. set it to 1).
This will help in keeping track of all the indexes of input array that have already been used in the previously detected CB number. -
Start checking from all the subarrays/substrings of smallest size i.e. 1 and then gradually increase the size.
You can refer to the following code for better understanding:
https://ide.codingblocks.com/s/120078
Hope, this would help.
Give a like, if you are satisfied.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.