- 1
why is my code always get "time limit exceeded"?
6 Answers
0
as it is c (not c++), you may not be able to use count method of algorithm header....
one suggestion from my side is to have preincrement in loop rather than post increment... so, change from i++ to ++i and so on for all two other loops
same with all variable value increment in switch case..
+ 1
Yoaraci I am not getting time limit exceeded with input as 1 2.. please check this or let us know which input caused this time limit exceeded for you ??
+ 1
it seems j is the problem, why you need to copy j to huruf ? then loop through huruf which is only contain j not the number you're trying to count.
0
Yoaraci correct me if I misunderstood...
there are 3 loops I , j and k... I loop representats number of test cases and hence I am not getting into optimisation of this loop..
you just need to find out occurance of 0 to 9 for each test cases (for each case, there can be more than one char array as input)
.. is this correct ?
- 1
actually i get time limit in the system where i gonna submit this code... so i have to make this code more efficient and only have to do less progress than this code to get the output...i wonder if this code can become more simple?
- 1
yes thats correct... thanks for answering me đ... but i still get time limitđ... maybe you have other suggestion?