Dynamic Programming : SPOJ EDIST

Either an admin was on, who saw and deleted it, or perhaps that poor guy was trying to answer with code or something but some error occurred.

Someways it used to seem easy because the default value is set to zero and also does not give segmentarion fault, but now I guess there are disadvantages too. Will stop using that and try to stick to arrays.

:slight_smile:

2 Likes

@vijju123

or maybe trying to inject a script, which did not work :stuck_out_tongue:

i checked his profile and one of his previous answers also seem like some ‘koi mil gya’ codewords. :stuck_out_tongue:

Lol XD. He is a spammer anyways. He will get banned soon.

I have done simple questions on spoj like COINS and FARIDA.

Just wanted to have more grasp on how to determine whether a question requires DP Approach or not.

Thanks for your resources. :slight_smile:

Which type of algos have to seen? Like LIS, LCS, Cutting a rod etc.

That will help me in sorting the Q which I can give to you. :slight_smile:

just take me as a beginner.

Assume that I haven’t seen any XD

Then I suggest you to look them here - Algorithms - GeeksforGeeks

It consists of “standard DP problems” and their algorithm/solutions. It is advised to try the Q first, and then look at how they solved it. Since the detailed answers are provided, I feel this should help you. :slight_smile:

1 Like

Saw another of @cosmosh post on a different question where he posted the link to edit that comment which he made here.

I guess he was thinking this would execute that script :expressionless:

Dont know much about this stuff, bear with me.

1 Like

Thanks @vijju123

1 Like

Eve I don’t know much about it. Its better to report it to @admin and leave it to them. :slight_smile:

1 Like

There is no way to get your hand in DP. The only you can do is to practice. If you think you can get perfection in DP by applying some problems in DP then you are wrong. DP problems needs practice and most important is imagination and nothing else. So whenever you got such DP problems then try to make recursive optimal substructure and then relate it with real situation.

1 Like

You can avoid sigsev by alloting arr of size 4*MAX to be on the safe side, I too face this problem sometimes.

Thanks. Will take this into account! :smiley:

@cosmosh has been banned. :slight_smile:

1 Like

Thanks @skbly7 , we all appreciate the efforts you admins undertake to keep forums clean. And I guarantee you that its MUCH better than what it was before :slight_smile:

2 Likes

I just want to add that sometimes you actually need a map instead of an array when the indices to be accessed are very large but we don’t need to calculate all of them. For example, this problem.

2 Likes

Okay, cool idea will implement it, I had solved that problem by saving numbers upto 10^6, if number was greater than 10^6, I had broken the number until it is less than 10^6 and thus produced the max

really thanks to you bro…it is really helpfull…i have also resolved my problem…