Hacker News new | ask | show | jobs
by pedrosorio 1295 days ago
Isn't the expected output YES YES NO YES NO?
1 comments

Yes according to the puzzle, but the operation as described isn’t clear (to me anyway) about which value should be used for the final assignment. It just says to use the value from the first element, but it’s unclear if it’s before or after that first element is replaced by the first operation.
I see, your description to GPT does not match the problem statement.

> It just says to use the value from the first element, but it’s unclear if it’s before or after that first element is replaced by the first operation.

Is the following python code unclear to you?

a = 0 b = 1 a, b = b, a

or alternatively:

a = [1,2,3,4,5] a[0:3] = a[1:3] + [a[0]]

There's nothing in the statement that indicates the assignments should be done one element at a time (if so, the order of the assignments would need to be specified). It's an atomic operation that circularly shifts the values in the array in the range l...r

I didn’t spend any time at all on it, I was curious to see if the results would be improved by describing the algorithm in prose rather than mathematical notation.