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...
-
This problem demonstrates the dramatic effect that consolidation accounting can have on a companys ratios. Fixed Motor Company (Fixed) owns 100% of Fixed Motor Credit Corporation (FMCC), its...
-
What is overflow? What is underflow? How can the probability of their occurrence be minimized?
-
Why are insurance policies held by the parties discoverable?
-
Interpreting disclosures regarding long-lived assets Exhibit 9.8 presents a partial balance sheet for Hewlett-Packard Company (HP). a creator and manufacturer of computer hardware and software and...
-
The master budget at Western Company last period called for sales of 226,700 units at $10.70 each. The costs were estimated to be $3.92 variable per unit and $226,700 fixed. During the period, actual...
-
Reba Dixon is a fifth-grade school teacher who earned a salary of $38,000 in 2019. She is 45 years old and has been divorced for four years. She receives $1,200 of alimony payments each month from...
-
A rising South Bay startup designs/manufactures touchscreens. Salesperson Dan is about to secure a deal with ABC-Tech that would be South Bays largest deal to date. The startup has an internal policy...
-
K Harry Taylor plans to pay an ordinary annuity of $5,200 annually for ten years so he can take a year's sabbatical to study for a master's degree in business. The annual rate of interest is 2.5%....
-
1. [1] The frequency of F-sharp (F2") is defined to be 92.50 Hz. What wavelength of this note? 2. [1] A microwave oven operates at a wavelength of 12.82 cm. What is the frequency of this...
-
Li Corporation reported pretax book income of $600,000. Tax depreciation exceeded book depreciation by $400,000. Li's beginning book (tax) basis in its fixed assets was $1,900,000 ($1,700,000) and...
-
Solve for x. -8+logs (x+4)=-6 x =
-
For the past ten years, Drew has worked in the accounting practice started by his grandfather and now run by his father and older sister. While Drew enjoys spending work time with his family, he...
-
Listen Rebecca Gollanek makes and sells wood colling racks for cakes, cookies, and breads. 30% of her brand sales are in Ontario, but the category as a whole has 38% of sales in Ontario. Calculate...
-
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)
-
The Excel formula to compute net income's percentage of sales in Exhibit 7-5, is a. \(=B 4 * B 2\) b. \(=B 4 / B 2\) c. \(=\mathrm{B} 2-\mathrm{B} 3\) d. \(=\mathrm{B} 4+\mathrm{B} 3\) EXHIBIT 7-5 A...
-
Match each component of a computerized accounting system with its meaning. Meaning Component Electronic linkages that allow different computers A. Server to share the same information Electronic...
-
Complete the crossword puzzle that follows. 2 3 4 5 6 Down: 1. Managers need over operations in order to authorize transactions and safeguard assets 3. Programs that drive a computer 4. Electronic...
Study smarter with the SolutionInn App