An algorithmic problem I don't know the solution to

Правка en1, от fkndonttrespass, 2023-01-20 21:03:10

You are given two integers x and y and array a of n integers. x is initially equal to zero. For every element in the a you can either add it to x, or you can subtract it from x. You have to tell whether you can make the number x equal to the number y by any means. An O(n^2) approach would work too. Additionally all the elements of a are <=300, I don't know if it's of any use.

Thanks.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский fkndonttrespass 2023-01-20 21:07:31 118
en1 Английский fkndonttrespass 2023-01-20 21:03:10 440 Initial revision (published)