17. Mango Blast Pro You are given two N x N matrices representing a field of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
17. Mango Blast Pro You are given two N x N matrices representing a field of mangoes say A and B. Each cell is one of three possible characters as follows. The two matrices are connected at cells (n-1,n-1) <bottom-right of matrix A and (n-1,0) <bottom-left> of matrix B. Note, Matrix B is a MIRROR image of Matrix A. means the cell is empty, so you can pass through, 'S means the cell contains a Mango that you can pick up and pass through, or X' means the cell contains a boulder that blocks your way. The goal is to return the maximum number of Mangoes you can collect by following the rules below & taking the PATH as follows. Start at (0,n-1) <top-right> in Matrix B represented as B(0,n-1). Move towards B(n-1, 0) <bottom-left>. • Crossover to A(n-1, n-1) <bottom-right> using the connector. Move to A(0,0) <top-left>. Now return to A(n-1,n-1) <bottom-right> • Crossover to B(n-1, 0) and back to B(0, n-1). •Total of 7 touchpoints i.e. B(0,n-1) > B(n-1, 0) > A(n-1, n-1) > A(0,0) > A(n-1, n-1) > B(n-1, 0) > B(0, n-1). Matrix B: there is no valid path between two touchpoints, then no mangoes can be collected & hence return 0. Input: First line contains an integer N which represents the size of the matrix. Its a square matr Next N lines carry a string which represent the row Ri in the matrix where i is [0,n-1]. Len is N btw. Constraints: 0<N<=100 Output: Integer which represents the maximum number of mangoes that can be collected 5 5 Example 1: Input 1: *$*$* $XXX* **$*$ $XXX$ *$*$* Output 1: 16 Explanation 1: The input maps to the 5x5 matrix as shown below. 17. Mango Blast Pro You are given two N x N matrices representing a field of mangoes say A and B. Each cell is one of three possible characters as follows. The two matrices are connected at cells (n-1,n-1) <bottom-right of matrix A and (n-1,0) <bottom-left> of matrix B. Note, Matrix B is a MIRROR image of Matrix A. means the cell is empty, so you can pass through, 'S means the cell contains a Mango that you can pick up and pass through, or X' means the cell contains a boulder that blocks your way. The goal is to return the maximum number of Mangoes you can collect by following the rules below & taking the PATH as follows. Start at (0,n-1) <top-right> in Matrix B represented as B(0,n-1). Move towards B(n-1, 0) <bottom-left>. • Crossover to A(n-1, n-1) <bottom-right> using the connector. Move to A(0,0) <top-left>. Now return to A(n-1,n-1) <bottom-right> • Crossover to B(n-1, 0) and back to B(0, n-1). •Total of 7 touchpoints i.e. B(0,n-1) > B(n-1, 0) > A(n-1, n-1) > A(0,0) > A(n-1, n-1) > B(n-1, 0) > B(0, n-1). Matrix B: there is no valid path between two touchpoints, then no mangoes can be collected & hence return 0. Input: First line contains an integer N which represents the size of the matrix. Its a square matr Next N lines carry a string which represent the row Ri in the matrix where i is [0,n-1]. Len is N btw. Constraints: 0<N<=100 Output: Integer which represents the maximum number of mangoes that can be collected 5 5 Example 1: Input 1: *$*$* $XXX* **$*$ $XXX$ *$*$* Output 1: 16 Explanation 1: The input maps to the 5x5 matrix as shown below.
Expert Answer:
Answer rating: 100% (QA)
Scala Language import scalaruntimeZipped Traversable2zipped Traversable2ToTraversable ... View the full answer
Related Book For
An Introduction to the Mathematics of Financial Derivatives
ISBN: 978-0123846822
3rd edition
Authors: Ali Hirsa, Salih N. Neftci
Posted Date:
Students also viewed these electrical engineering questions
-
You are given two discrete random variables X, Y that assume the possible values 0, 1 according to the following joint distribution: (a) What are the marginal distributions of X and Y? (b) Are X and...
-
You are given two urns each containing two biased coins. The coins in urn I come up heads with probability p1, and the coins in urn II come up heads with probability p2 p1. You are given a choice of...
-
You are given two discrete random variables X. Y that assume the possible values 0, 1 according to the following joint distribution: (a) What are the marginal distributions of X and Y?(b) Are x and Y...
-
Hemming Co. reported the following current year purchases and sales for its only product. Required Hemming uses a perpetual inventory system. Determine the costs assigned to ending inventory and to...
-
Identify five major considerations that are introduced when the client uses information technology.
-
Accounting Changes Aston Corporation performs year-end planning in November of each year before their calendar year ends in December. The preliminary estimated net income is $3 million. The CFO, Rita...
-
Im gathering some information about the sales/collection process and how it is supposed to work. Okay?
-
Peoria Corp. just completed another successful year, as indicated by the following income statement: Presented here are comparative balance sheets: Other information is as follows: a. Dividends of...
-
What are the capabilities of online analytical processing (OLAP)? What is the value of this tool to business? Is OLAP much different from data mining and warehousing? Explain..!
-
Skylar and Walter Black have been married for 25 years. They live at 883 Scrub Brush Street, Apt. 52B, Las Vegas, NV 89125. Skylar is a stay-at-home parent and Walt is a high school teacher. Skylars...
-
What are the limitations of of analysing and interpreting financial statements for a single year?
-
List the steps necessary to avoid negative consequences of using NDT methods? List 5 negative consequences that may result from safety violation? Imagine you are construction supervisor, and you...
-
Which -(VxyP(x, y))? Explain. Ex-(VyP(x, y)) Vx-(ByP(x, y)) is logically equivalent to
-
Createe a PHP script to generate multiplication table. The user will enter the number of rows and columns (min of 1 max of 10 only) in a text box. If the user enters greater than 10 or less 2. Create...
-
The income statement of Paxson Company is presented here Paxson Company Income Statement For the Year Ended November 30,2014 Sales Revenue $7,600,000 Cost of goods sold Beginning Inventory $1,900,000...
-
Amitabh Bachan (AB), the Managing Director (MD) of Clothes Indonesia, was on a flight from Bangalore to Singapore on his way to Jakarta after a vacation. As he settled into the flight, his thoughts...
-
The Common Stock account for Baltimore Corporation on January 1, 2020 was $60,000. On July 1, 2020 Baltimore issued an additional 5,000 shares of common stock. The Common Stock is $5 par. There was...
-
The National Collegiate Athletic Association (NCAA) and the National Federation of State High School Associations (NFHS) set a new standard for non-wood baseball bats. Their goal was to ensure that...
-
We observe that current price of a zero-coupon bond with one year maturity is $0.97 (paying $1 at t = 1). We also observe the current implied forward rate is 2.5%. Under the forward measure, price a...
-
If it exists, find the limit of the following sequences for n = 1, 2, 3 . . . : (a) xn = (1)n (b) xn = sin(n/3) (c) xn = n(1)n (d) xn = sin(n/3) + (1)n/n. Is this sequence bounded?
-
Let Y be a random variable defined by where W is a standard Wiener process. Compute E(Y) and E(Y2). (9.137)
-
Which mechanism of bacterial genetic transfer does not require recombination with the bacterial chromosome?
-
Explain why small deletions and duplications are less likely than large ones to have a detrimental effect on an individuals phenotype. If a small deletion within a single chromosome happens to have a...
-
Explain why inversions and reciprocal translocations do not usually cause a phenotypic effect. Then explain how they can do so in certain cases.
Study smarter with the SolutionInn App