October LunchTime UNofficial Editorials (First two problems) Revised

Taran, Can you help me debug my code? It seems like I’m missing some corner cases.

Edit: I’m sorry. The link was wrong. This is link to solution. CodeChef: Practical coding for everyone

Hey taran I am getting wa for the 2nd subtask in the problem BUGCAL. Any testcase where I might fail. Here’s the link to my solution - link text

Hey @taran_1407, did you solve the third problem i.e. Optimal Subset?
I have a conventional O(n^2) DP approach and optimizing it seems way too difficult to me and I can’t even think of any other way to approach that problem too.
Any suggestions on that?

Loving your explanations dude.

well done C.A :stuck_out_tongue: as your institute suggests

code , can you please help me out why it is giving wrong answer.

@taran_1407
I am getting run-time error. I tried too much to find where i am getting this but failed.
please help me.
this is my code–>
https://www.codechef.com/viewsolution/15994545
thank you

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: