Consider the above figure to be a set of 7 received blocks of bits from the bsc. In how many distinct ways can you climb to the top. Print a right aligned staircase with n steps. Each time you can either climb 1 or 2 steps.
Of lines in output is equal to height of the staircase. For the generalization of above approach the following recursive relation can be used. It takes n steps to reach to the top. Generalization of the problem how to count the number of ways if the person can climb up to m stairs for a given value m.
You are climbing a stair case. A common algorithm found in technical interviews is the climbing staircase problem. Each time you can either climb 1 or 2 steps. Let s work through the following problem.
Since every line is nearly the same and only one character changes at a time you should take advantage of that and use an array as a buffer. The order of the steps matters. Of hashes in last line is equal to the height of staircase. Such a decoder is referred to as a sliding window decoder.
For example if m is 4 the person can climb 1 stair or 2 stairs or 3 stairs or 4 stairs at a time. Input n as the height of the staircase draw a staircase with the given height. Given n will be a positive integer. Today s algorithm is the climbing stairs problem.
Staircase codes are decoded by using an iterative decoder operating over several received blocks. For example if the input were 2 there s 2 stairs in the staircase then there are 2 distinct ways to climb to the top. The decoder will operate over these blocks shift out a decoded block and shift in a newly received block. It takes n steps to reach to the top.