Question: C 81 Problem statement: Given a string s consisting of stars and bars I,an array of starting indices starIndex,and an array of ending indices endIndex,determine

C 81 Problem statement: Given a string s consisting of stars and bars "I",an array of starting indices starIndex,and an array of ending indices endIndex,determine the number of stars between any two bars within the substrings between the two indices inclusive. NOTE that in this problem indexing starts at 1. . A Star is represented as an asterisk [*=ascii decimal 42] A Bar is represented as a Pipe ["I"-ascii decimal 124] Example: s="/**1*1' startindex=[1,1] endindex=[5,6] For the first pair of indices (1,5) the substrings is "***". There are 2 stars between a pair of bars For the second pair of indices (1,6) the substring is "***" and there are 2+1=3 stars in between the bars. Both of the answers are returned to the array [2,3]. Constraints: int [n];each element[i] answers the query of startIndex[i] to endindex[i] Constraints 1<=n<=105 1<-StartInde[i]<-endIndex[i] Each Character of s is either *** or "1" >Input Format for Custom testing

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!