Cannot Understand the Question!

Cannot Understand the Question !

@exceptionXD hey, this problem is somewhat similar to binary_search or divide and conquer, or you may think this in terms of query part of segment trees. Basically, you have to use divide and conquer. Think of some recursion to solve it.

Let me help you understand the sample case.

9 6 9

  1. Count the number of characters in the final answer. This is easy using recursion.
  2. So you have a string from index 1 to index 15.
  3. mid=(15+1)/2 = 8.
  4. Is 8 between L and R. Yes. This means that character at this point needs to be counted. Now what is the 8th character. Characters 1-7 belong to floor of N/2. Characters 9-15 belong to floor of N/2. And character 8 is for N%2.
  5. Let the recursion solve from index 1 to 7 and for index 9 to 15.
  6. Be careful with the base cases.
    :slight_smile:

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.