All Questions
6 questions
3
votes
2
answers
1k
views
Counting the number of ways to decode a string
I am working on problem where I need to decode a string:
A message containing letters from A-Z is being encoded to numbers
using the following mapping:
'A' -> 1
'B' -> 2
...
'...
3
votes
3
answers
2k
views
Tower Hopper problem recursive approach
The Tower Hopper problem gives us an array of values representing heights that express how far we can jump from a certain tower, and asks whether there's a way to get from ...
3
votes
1
answer
446
views
Find the maximum possible summation of differences of consecutive elements
Array A contains the elements, \$A_1,A_2, \ldots, A_N\$.
And array B contains the elements, \$B_1,B_2, \ldots, B_N\$.
There is a relationship between \$A_i\$ and \$B_i\$: any element \$A_i\$ ...
2
votes
1
answer
108
views
dynamic programming solution for a string ending with 0, 1 or 2
A string that contains only 0s, 1s, and 2s is called a ternary string. Find a total ternary ...
1
vote
1
answer
850
views
Compute the number of ways a given amount (cents) can be changed
Given an infinite number of different coin types (such as pennies,
nickels, dimes, quarters) find out how many ways n cents can be
represented.
My code appears to work (although I am curious to ...
6
votes
1
answer
3k
views
Longest common subsequence length and backtracking the string
Problem: Given two sequences, print the longest subsequence present in both of them. A subsequence is a sequence that appears in the same relative order, but not necessarily contiguous. For example, “...