October LunchTime UNofficial Editorials (First two problems) Revised

Can anyone give me a test case where my code fails? It’s working well for all the test cases I checked.

PLEASE HELP ME!!!

I’m storing the digits in an array from one’s place. Then I am iterating through all the digits and finding the new number by removing that particular digit. Now, I’m checking whether it is divisible by 6 or not and if it is then I check whether it is largest number possible which I initially set to -1. At last I’m printing the new number with k-1 digits where k is the total number of digits in the initial number. Leading zeros will be printed since I used %0*d and passed k-1 and maxnum to it. LINK:-My Solution

Taran, sorry for posting that link which didn’t work. I updated it. Can you help me?

In problem maximum number in my code I am not able to figure out mistake.
It gives wrong answer on submission.

Can anyone help me debugging it.
Link to my code is

Here.

Please help :slight_smile:

i dont know why my code is getting wrong anser.
please help me;
link is CodeChef: Practical coding for everyone

i dont know why my code is getting wrong answer, please help; link CodeChef: Practical coding for everyone

simply just check when sum of the digit >= 10 take mod of the ans and store it in an array during calculation in O(n) time then print the same

Hey can anyone plz tell me what’s wrong with this code?
CodeChef: Practical coding for everyone

Mate, Your solution is O(n^2) because Substring function itself take O(N) time because it has to transverse whole string. Further, using Integer.parseInt this many times, you can simply store a number in array, ith element of array being ith digit of number (from left to right or right to left, as you feel comfortable with. :slight_smile: ).

2 Likes

Mate, i replied on your thread too. I’m still working with your solution only. :slight_smile:

sorry bro didn’t see then. thanks :slight_smile:

Try Following test case.

1

55 54

Correct answer 9

Your answer 09

No problem mate.

By the way, why are you using variable p in your code??

1 Like

Thanks mate. :slight_smile:

@taran_1407 but wouldn’t the calculator print exactly 09 only?

Which language you are talking about mate??

I work with java. Either share code link. :slight_smile:

Nope, It isn’t mentioned in problem but a calculator always print 9, not 09. You may try. :slight_smile:

Yes, but since the calculator is faulty and skips carry i thought it should print 5555+5555 as 0000.
Thanks for replying though.

No problem at all.

By the way, the calculator isn’t that faulty :smiley:

1 Like

Here is my sol:CodeChef: Practical coding for everyone