actually there are infinite number of sequences that match it
for example if the absolute differences are 3 2 5 1
one possible sequence is 6 3 5 0 1 one other is 7 4 6 1 2 or 8 5 7 2 3
and you can add any integer value to all elements and the result will still
be valid
actually you can start with any number and and then the second number will
be equal to the first number that you chose plus/minus the first absolute
difference and so on

so if we are given the first element of the sequence there are 2^(n-1) ways
to find a valid sequence because for each absolute difference we can either
add the absolute difference to the last sequence element or subtract the
absolute difference from it



On Mon, Dec 12, 2011 at 9:01 PM, KAY <amulya.manches...@gmail.com> wrote:

> If for a number n digits long, the absolute difference between
> adjacent digits is given, how to find out the number of different
> numbers with these absolute differences ?
>
> for eg,
> if n=5
> and the absolute differences are
> 3 2 5 1
> then 1 possible number is
> 6 3 5 0 1    (because |6-3|=3,|3-5|=2 and so on...)
>
> How many such numbers will be there?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to