Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Intelligent Image Databases Towards Advanced Image Retrieval

Authors: Yihong Gong

1st Edition

1461375037, 978-1461375036

More Books

Students also viewed these Databases questions

Question

Describe the types of power that effective leaders employ

Answered: 1 week ago

Question

Describe how leadership styles should be adapted to the situation

Answered: 1 week ago