Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Amazons database doesn't support very large numbers, so numbers are stored as a string of binary characters, ' O ' and ' 1 ' .

Amazons database doesn't support very large numbers, so numbers are stored as a string of binary characters, 'O' and '1'. Accidentally, a '!' was entered at some positions and it is unknown whether they should be 'O' or '1'. The string of incorrect data is made up of the characters 'O','1' and ! where !' is the character that got entered incorrectly. '!' can be replaced with either 'O' or '1'. Due to some internal faults, some errors are generated every time O' and '1' occur together as '01' or '10'in any subsequence of the string. It is observed that the number of errors a subsequence '01' generates is x, while a subsequence '10' generates y errors. Determine the minimum total errors generated. Since the answer can be very large, return it modulo 10\deg +7. For example, given string errorString ="101!1", x =2, y=3, If the !'at index 3 is replaced with 'O', the string is "10101". The number of times the subsequence 01 occurs is 3 at indices (1,2),(1,4), and (3,4). The number of times the subsequence 10 occurs is also 3, indices (0,1),(0,3) and (2,3). The number of errors is 3*x+3* y =6+9=15. If the !' is replaced with '1', the string is "10111". The subsequence 01 occurs 3 times and10 occurs 1 time. The number of errors is 3*x + y =9. The minimum number of errors is min(9,15) modulo 109+7=9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago