6 kyu

Stair number [easy]

62 of 98nicotina04

Description:

Let's look at the number 12343.

This number differs by 1 in all adjacent digits. This number is called the 'Stair number'.

When number's length is given, write a function to find out how many Stair numbers are in total length. (Testcases are never start with zero.)

Returns the remainder of the answer divided by 1000000007 (1e9 + 7)

/Input/

1 <= n <= 1000 // n is integer.

/Example Output/

solution(1) returns 9.
solution(2) returns 17.
Dynamic Programming
Algorithms

Stats:

CreatedMay 13, 2019
PublishedMay 13, 2019
Warriors Trained933
Total Skips117
Total Code Submissions887
Total Times Completed98
JavaScript Completions62
C++ Completions42
Total Stars19
% of votes with a positive feedback rating80% of 40
Total "Very Satisfied" Votes28
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes4
Total Rank Assessments14
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • nicotina04 Avatar
  • Blind4Basics Avatar
  • monadius Avatar
  • MikChan Avatar
  • dfhwze Avatar
Ad