Problem 1102. USC Fall 2012 ACM : Find Largest Water Concentration
This Challenge is to solve Question B, Water?, of the USC ACM Fall 2012 Contest.
Given a character array A of minerals(A:Z) and a vector, iswater, of Water bearing minerals(A:Z) and a minimum rectangular size to evaluate, determine the Region with the Maximum water density. Report the larger region if two have the same density.
Specifically, report the Total water symbols and the Area of the highest density region.
Input: [ A, iswater, s ]
Output: [Total Water Symbols, Area of Rectangle];
The full USC data file
Example:
Input: A, iswater, s
Matrix A ITTTTHHHHTTTT IXYOXOOOOOOXI IOOOXOOOOOXXJ IYOOOOXOOOOOI IXXOYOOYOOOOI IAAAAAXAXAAAJ
iswater vector YX
s is 3; This is the minimum allowed rectangle size
Output: [8 16] as there are 8 "water symbols" in a 4x4=16 square TLC:(2,2)
The Winning B solution is very large.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
-
Read a column of numbers and interpolate missing data
2223 Solvers
-
Project Euler: Problem 5, Smallest multiple
1267 Solvers
-
Removing rows from a matrix is easy - but what about inserting rows?
203 Solvers
-
Split a string into chunks of specified length
1552 Solvers
-
360 Solvers
More from this Author294
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!