28th Oct 2018, 10:25 AM
Yoaraci
Yoaraci - avatar
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..
28th Oct 2018, 11:03 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 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 ??
28th Oct 2018, 10:39 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 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.
29th Oct 2018, 8:11 AM
Taste
Taste - avatar
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 ?
28th Oct 2018, 10:56 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
- 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?
28th Oct 2018, 10:44 AM
Yoaraci
Yoaraci - avatar
- 1
yes thats correct... thanks for answering me 😊... but i still get time limit😂... maybe you have other suggestion?
28th Oct 2018, 1:57 PM
Yoaraci
Yoaraci - avatar