#StackBounty: #java #dynamic-programming Reduce the base 10 digit number by removing 2 consecutive digits in java

Bounty: 50

Below is the problem statement that I have:

You get number written in base 10, you have to delete it completely by choosing two consecutive digits and deleting them. But the sum of those 2 digits should not be 17. We call the numbers which are fully deleted by repeating the above operation as "Good".


  1. 9889 => Delete 88 to get 99
  2. 99 => Delete 99 to fully delete number.
    Conclusion: 9889 is good.
    NOTE: We cannot remove 98 or 89 as the sum of these 2 digits is 17.

Given a number N(even) you want to find the number of good N-digit number modulo 10^9 + 7. Include the N digit number containing leading zeros too.

Test Cases:

Case 1:

Input: 2
Output: 98

Case 2:

Input: 4
Output: 9926

Case 3:

Input: 442
Output: 417551213

I have tried solving this using various codes but not able to get the result.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.