wu :: forums
« wu :: forums - Array conversion »

Welcome, Guest. Please Login or Register.
Apr 17th, 2025, 3:27pm

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: SMQ, Eigenray, Icarus, Grimbal, towr, ThudnBlunder, william wu)
   Array conversion
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Array conversion  (Read 758 times)
sateesp
Newbie
*





   


Gender: male
Posts: 35
Array conversion  
« on: Aug 29th, 2010, 5:56am »
Quote Quote Modify Modify

Given an array B[] of size N, where each element in B[i] = A[i] + A[(i+1) %N]. Find the array A[]
 
Example: Given B[] =  {3,5,7,5}
We need to print A[] = {1,2,3,4}  
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Array conversion  
« Reply #1 on: Aug 29th, 2010, 6:42am »
Quote Quote Modify Modify

There are many possible such arrays if N is even. For example, [-1,4,1,6] would work just as well, or [13,-10,15,-8], or in general [1,2,3,4] + k*[-1,1,-1,1].
 
So for even N you can just start with A[0]=0, and work from there.
« Last Edit: Aug 29th, 2010, 6:45am by towr » IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board