brian.prakash
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
First think which came into my mind is Huffman encoding tree , but it is not the best solution. As although it's apart from providing compressed code, but it has to maintain a criteria that all code should be unique(prefix-free).
Optimal BInary Search tree is ideal solution for it.
Comment hidden because of low score. Click to expand.
0
of 0 vote
What about this DP solution
Let S contains the given number
F(n) = F(n-1) + F(n-2), if S[n-1,n] <= 26
F(n-1), if S[n-1,n] > 26
F(1) = 1
F(2) = 2, if S[1,2] <= 26 else 1
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- brian.prakash May 03, 2014