Class Assignment problem

I’m getting TLE. I think my logic is okay. How to optimise?
Code Link: https://ide.codingblocks.com/s/135133

Hello @raj.bmp.333,

  1. The output format of your code does not match with that of the question:
    Observe the output format carefully

    In #digit : count, the digit represents the nth test case
    You can refer to the video, Count Binary Strings Hint from your course as it is a similar question.

2… TLE is due to the logic you have applied:
It is exceeding the time limit for large inputs n=44
Approach:

Hope, this would help.
Give a like if you are satisfied.

1 Like