An Army Helicopter java program The host government has promised that in addition to the security guards in each match, there will be a platoon of elite commandos that will be deployed for extra protection in each stadium for each match. In order to move quickly between cities and stadiums there will be a dedicated army helicopter on permanent stand by. The army helicopter has to land in city (rectangular area) which contains several towers (mobile communication towers). For the safe landing of the helicopter, the landing space must not contain any tower in the landing space. A helicopter needs a square shaped landing area which has the side length greater than or equal to the helicopter length. Given a description of the tower positions of the city, you have to find the largest helicopter that can land in the city. Input Format The first line of input consists of number of rows (rectangular area or string arrays), N Next N lines consist of string array. Each string contains symbols (either 'x' or 'o' or '#'). x represents a tower, 'o' represents empty space and '#' is a delimiter between the 'x' and 'o'. Constraints 1 <= N <= 500 Output Format Print the length of the largest helicopter that can land in the city else print -1 if input is invalid. Sample TestCase 1 Input 5 x#o#o#o#x#o x#o#o#o#x#x x#o#o#o#x#x x#o#x#o#o#x x#o#x#o#o#x Output 3
Answers
Answer:
An army helicopter(java program)
the host government has promised that in addition to the security guards in each match, there will be a platoon of elite commandos that will be deployed for extra protection in each stadium for each match. in order to move quickly between cities and stadiums there will be a dedicated army helicopter on permanent stand by.
the army helicopter has to land in city (rectangular area) contains several towers (mobile communication towers). for the safe landing of the helicopter, the landing space must not contain any tower in the landing space. a helicopter needs a square shaped landing area has the side length greater than or equal to the helicopter length. given a description of the tower positions of the city, you have to find the largest helicopter that can land in the city.
input format
the first line of input consists of number of rows (rectangular area or string arrays), n
next n lines consist of string array. each string contains symbols (either 'x' or 'o' or '#'). x represents a tower, 'o' represents empty space and '#' is a delimiter between the 'x' and 'o'.
constraints
1 < = n < = 500
output format
print the length of the largest helicopter that can land in the city else print -1 if input is invalid.
sample testcase 1
input
5
x#o#o#o#x#o
x#o#o#o#x#x
x#o#o#o#x#x
x#o#x#o#o#x
x#o#x#o#o#x
output
3
answer
Answers: 3
Get
Other questions on the subject: Computer Science
image
Computer Science, 21.08.2019 18:00, hardikvashist01
Genetic algorithm for neural network weight optimization
Answers: 1
continue
image
Computer Science, 22.08.2019 20:00, rudru10
Day is celebrated as world computer literacy day?
Answers: 2
continue
image
Computer Science, 22.08.2019 22:00, Firdaus17f
Some of the popular internet browsers
Answers: 2
continue
image
Computer Science, 24.08.2019 03:00, riddhima95
Write an algorithm to check whether the given number is divisible by 2 or not
Answers: 3
continue
Do you know the correct answer?
An army helicopter(java program)
the host government has promised that in addition to the secu...
name
Answer
Questions in other subjects:
Konu
Accountancy, 26.06.2021 02:01
From the following balances obtained from the record of mr shankar prepare the trading account for the year ending 31 st March 202 p0...
Answers
Konu
Business Studies, 26.06.2021 02:01
Verbal skills, non-verbal skills and listening skills are elements of...
Answers
Konu
Hindi, 26.06.2021 02:01
Waywashay ke name or waywashay ke prakar or inglish name...
Answers
Konu
Math, 26.06.2021 02:01
In a quiz Ashok scored +20, (-15), +10, and (-5) scores. What are his final scores?...
Answers
Konu
Hindi, 26.06.2021 02:01
हयः सोमवासरः l अघ कः वासरः ?...
Answers
Konu
Math, 26.06.2021 02:01
Simplify 8√26²-√51².please solve it ...
Answers
Konu
English, 26.06.2021 02:01
Thank u cho much ...
Answers
Konu
World Languages, 26.06.2021 02:01
Kya hehehe laga rhi hai wo kiska lover hai....
Answers
Konu
Math, 26.06.2021 02:01
Are 5/2 and 10/4 equivalent fractions...
Answers
Konu
Computer Science, 26.06.2021 02:01
Write your question here (Keep it simple and clear to get the best answer)one is printe output...
Answers
Other tasks in the category: Computer Science More task
Total solved problems on the site: 26414957
By using this site, you consent to the use of cookies. You can refuse to use cookies by setting the necessary parameters in your browser.