I am getting 45. My first two questions and the first part of the last question is correct. I am in class 10th can someone please tell me the expected cutoff.
@siddharth2000 I think its the same algo used in dividing a string into least no of palindromes I set the rightmost 1 position to value of 1 and then kept moving leftward and assume there is a partition there.Then if th selected position is 1 then the number of ways from this position is 1+(number of ways from next position) , if the selected positions value is 0 then find out the smallest possible continuous good string from this position and set its value to 1+(value of position just after the position of the smallest continuous good string). Answer is the sum of these numbers.I can’t say that it is completely correct as I figured this out only after 173 mins
@devildudeja I thought of solving it recursively as substrings would repeat themselves as I kept partitioning from right to left but still decided to solve it by brute force
@devildudeja I thought of solving it recursively as substrings would repeat themselves as I kept partitioning from right to left but still decided to solve it by brute force
@sparsh_temani in the first question firstly you should be writing down the given array with the index written on the top for ease and then u should write the i % 5 value on the top of each index i so that you know what you can choose. Then lastly select the maximum value from each unique i % 5 and then choose the maximum values.(remember even in the first part you can’t choose 6 elements in fact you can never choose more than 5 as there are only five unique possible values of i % 5 i.e, 0, 1, 2, 3, 4):
P.S if this solved your problem please give me some reputation points