Insert Operator(Contest)
Insert Operator easy Time Limit: 2 sec Memory Limit: 128000 kB
PreviousInfinity Stones : Form Black Order - The Army of Thanos (Contest)NextInteger Modification (contest)
Last updated
Insert Operator easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
You are given a sequence of numbers of size N. You have to find if there is a way to insert + or - operator in between the numbers so that the result equals K. Input The first line of input contains two integers N and K. The next line of input contains N space- separated integers depicting the values of the sequence.
Constraints:- 1 <= N <= 20 -10^15 <= K <= 10^15 0 <= Numbers <=10^13 Output Print YES if possible else print NO. Example Sample Input:- 4 4 1 2 3 4
Sample Output:- YES
Sample Input:- 4 1 1 2 3 4
Sample Output:- NO
link: