I read it before posting. What's the problem? Should I not have said that this is my homework?
Anyway... I'm sorry if you think I can't post a decent thread.
Maybe describe what you mean by a hill shape, describe how you would determine if a number describes a hill shape. Say why 3681 is a hill and 24839 is not a hill. etc.
Oh, ok. Think of the y axis in the xOy axis system. 1 is the smallest number on the axis and 9 is the highest so for example 12345678987654321 would describe a hill shape.
A number is a hill number if the numbers before the highest (12345654321) are in ascending order and the numbers after the highest (12345654321) are in descending order.
Sorry for not being exact at first.
previous digit is minus one
previous state is ascending
For each digit
{
if current digit minus previous digit is greater than zero
current state is ascending
else
current state is descending
if previous state is descending and current state is ascending
is not a hill
finish
previous state is current state
previous digit is current digit
}
is a hill
finish