Maximum summed powersets with non-adjacent items

0

Please login or register to vote for this query.

(click on this box to dismiss)

Joomla

Q&A for Joomla! administrators, users, developers and designers

DECLARE @ table(x varchar(max),i int identity)

INSERT @ values(2),(4),(6);

WITH C(y,j,v)as
(
SELECT *,x*1
FROM @
UNION ALL
SELECT y+','+x,i,v+x
FROM @ JOIN C ON j+1<i
)
SELECT TOP 1*FROM C ORDER BY-v

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results