Remove loops from a walk

0

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy Meta

Q&A about the site for science fiction and fantasy enthusiasts

DECLARE @ table(a CHAR,b INT identity)

INSERT @ values
('D'),('U'),('L'),('L'),('L'),('R'),('L'),('R')

WHILE @@rowcount>0WITH C
as(SELECT*,sum(ascii(a)/12-6+3/(ascii(a)-79)*pi())over(order
by b)x FROM @)DELETE C
FROM C,(SELECT top 1max(b)i,min(b)j,x
FROM C GROUP BY x HAVING SUM(1)>1or x=0ORDER BY 2)z
WHERE(z.x=0or z.j<b)and z.i>=b
SELECT*FROM @

Enter Parameters

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