Problem 1916. GJam 2013 Veterans: Hedge
This Challenge is derived from Hedgemony. This is the Large data set with N<=1000.
The GJam story goes that the Baron trims the bushes(1:N) starting with bush 2 thru the next to last bush(N-1). A bush is trimmed to the average of the adjacent bushes. If the bush is less than the adjacent average the bush is left alone. Report the final Height of the next to last bush following its trimming.
Input: hin , Vector length N<=1000 with values between 1 and 1000.
Output: hout , Final Trimmed Height of the next to last bush (accuracy <2e-4)
Examples: [hin] [hout]
[1 2 3 6 7] [5.000000] [5 8 9 9 9] [8.500000] [1 2 2 2 2 2] [1.937500]
Commentary:
1) Best Time: 7 minutes 2) Solved by 27 of 32
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers24
Suggested Problems
-
Numbers with prime factors 2, 3 and 5.
474 Solvers
-
361 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
376 Solvers
-
Rounding off numbers to n decimals
4483 Solvers
-
8932 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!