39m 6s left Help All 1 1. Buy Letters Coding Description Problem Statement Ravi went to a letters shop to buy the some l

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

39m 6s left Help All 1 1. Buy Letters Coding Description Problem Statement Ravi went to a letters shop to buy the some l

Post by answerhappygod »

39m 6s Left Help All 1 1 Buy Letters Coding Description Problem Statement Ravi Went To A Letters Shop To Buy The Some L 1
39m 6s Left Help All 1 1 Buy Letters Coding Description Problem Statement Ravi Went To A Letters Shop To Buy The Some L 1 (253.36 KiB) Viewed 18 times
ans please
39m 6s left Help All 1 1. Buy Letters Coding Description Problem Statement Ravi went to a letters shop to buy the some letters in sequence such that he can create a string 's' with bought letters.. The shopkeeper has put the total of n letters in a line which are available to sell, and sets the price of i'th letter as (n-1) coins, where is the index of each letter in line starting from 0 to n-1. If Ravi has bought the i'th letter than he can't buy the letters of (0 to i'th) index any more. Also, Ravi will buy the letters in a sequence, such that the sequence form the string s. At what minimum price can Ravi buy the letters he want to buy. Input Format • First line will be the string 's that Ravi want to create after buying the letters. • Second line will be the string 'str' of n letters, that shopkeeper has arranged the letters to sell. Constraints • (1 <= s.size() <= le5) (1 <= str.size() <= 1e5) • it is guaranteed that all the letters in both the strings are the lowercase english alphabets. • Output Format • Print the minimum price in which Ravi can buy the letters or -1 if it is impossible to buy all the letters of s, in a correct 1 1 1 1 20 21 22 23 24 25 Test Re
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply