labrepos / elements-of-programming-interviews

Automatically exported from code.google.com/p/elements-of-programming-interviews
Other
0 stars 0 forks source link

solution 3.6 error #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. let A = (-1, -1)
2.
3.

What is the expected output? What do you see instead?
0 0
1 3
What version of the product are you using? On what operating system?
newest version
ubuntu 12.0.4, g++ 4.6.3

Please provide any additional information below.
A[j]>=A[j+1] will be out of range, and vector<int> has default value of 0, so 
if A has negative values, it would generate additional increasing subarray.

Original issue reported on code.google.com by aali...@gmail.com on 26 Mar 2013 at 12:42

GoogleCodeExporter commented 8 years ago
Hey,

Thanks for your report. I just ran the program at 
https://code.google.com/p/elements-of-programming-interviews/source/browse/trunk
/Longest_increasing_subarray.cpp according to the input you provided (i.e., A = 
{-1, -1}) but the result seems fine to me (i.e., the program outputs 0 0 
instead of 1 3). I think the update on March 9 probably fixes the problem you 
mentioned. Please feel free to ask questions and provides us feedback, and we 
really appreciate any comments.

Original comment by TsungHsi...@gmail.com on 26 Mar 2013 at 12:56

GoogleCodeExporter commented 8 years ago

Original comment by TsungHsi...@gmail.com on 9 Apr 2013 at 6:16