#codingexercise
Get the last minimum value in a set of positive integers
Int getLastlocalMin (int [] v)
{
If (v == null) return -1;
for ( Int u = v.length - 2; u >= 0; u--)
If (v [u] > v [u+1]) return v [u+1];
Return v [0];
}
Get the last minimum value in a set of positive integers
Int getLastlocalMin (int [] v)
{
If (v == null) return -1;
for ( Int u = v.length - 2; u >= 0; u--)
If (v [u] > v [u+1]) return v [u+1];
Return v [0];
}
No comments:
Post a Comment