Computer Science, asked by ramshiva188, 5 months ago

my life is over
You found a number in base-10 written on your computer screen You want to delete many digits by repeatedly choosing any two consecutive digits and deleting them
The remaining als squish overcome together like they would in an actual editor. But you only love 17. So the sum of those 2 chosen digits must be 17
Example 389099 > Delete middle first 89 to get 3899 -> Delete middle 89 to get 39 So final length remaining number's length is 2
Given an initial number containing many digits, determine the final length of the remaining number assuming you delete as many digits as possible
Note The number has no digits equal to init
Function Description
Complete the loveSeventeen function in the editor below. It has the following parameters
Name
Type
Description
Parameters
S
STRING
number
Return
The function must return an NTEGER denoting the the final length of the number
Constraints
• 1 slens) 100
Input Format For Custom Testing
The best ne contains a string Sderot ng the number

Answers

Answered by sourasghotekar123
0

Answer:   python code

def bino(n, k):

 if not 0<=k<=n: return 0

 b=1

 for t in range(min(k, n-k)):

  b*=n; b//=t+1; n-=1

 return b

def f(n):

 bad = 0

 

 for k in range((n - 2) // 2 + 1):

  bad += 9**k * bino(n, k)

 

 return (10**n - 2 * bad) % (10**9 + 7)

 

print(f(389099))

Explanation:

  • Interested in making a career in programming? Take into account picking up the Python programming language.
  • Or are you curious about picking up new languages? Programming in Python is typically one of the most popular alternatives for both due to its simplicity of learning and broad capabilities.
  • The Python programming language uses straightforward object-oriented programming approaches and very efficient high-level data structures.
  • Python programming also makes advantage of dynamic typing and a terse, straightforward syntax.
  • If you're looking for a language for efficient application development and scripting across a variety of domains, it would be difficult to find a better option than Python.
  • One of Python programming's key benefits is that it is interpretative.
  • The Python interpreter is available in binary and source formats on the Python website and the standard library work flawlessly on all widely used operating systems.
  • The Python programming language is also freely distributable, and the same website also provides advice and links to other outside tools, programs, modules, and documentation.

#SPJ1

https://brainly.in/question/53888964

Similar questions