Programming Interview Question: Print Maximum number of As using Ctrl-A, Ctrl-C, Crtl-V

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

@IDeserve please accept my apology for saying there was an error in your algorithm. The code shown at the end of the video works perfectly and this problem is well suited for a dynamic programming solution. I misunderstood the proof and must have applied that misunderstanding to my own implementation of the algorithm. I'm sorry if my comments negatively affected your viewers.

Please approve this comment and my reply to Daksh Chhabra who pointed out my mistake.

stabguy
Автор

This is really good explanation
Thanks

rupakkorde
Автор

great explanation, you made it too simple to understand

divyankakumari
Автор

Can u explain by using N keystrokes in notepad that how many A will print

DAEC_ShashankJS
Автор

For n = 14 your program returns 42. The correct answer must be at least 50 because: *A *C *V *A *C *V *V *V *V
I think there's something wrong with your proof that there's no advantage to using multiple *A *C *V

stabguy
Автор

Check this case out
8N = f(N) * 8

According to you it is
8N = f(N)*9

brnaveen
Автор

This can be solved by dynamic programming

krishnajanoliya
Автор

Below Solution is dp based approach with comment

HustlerCoder
Автор

maxAsSolution[i] == -1 should be outside the loop as : if (dp[n] != -1)
return dp[n];

pardeepsharma
Автор

This doesn't seem to account for multiple (*A, *C, *V) keystrokes.

onresonance
Автор

This is not the way how you approach a dp problem though, like for how many test you would

Nikhil-qdup
Автор

thank you i deserve can you please explain the proof some more clearly

bandaruyeswanth
Автор

How can we print 4A with N=4?
When we type A, then *A, *C, *V....did we not use all 4 keys already? Which means we can print only 2As, ie., result=2??

sam_s