Given an equation x==y for ex 111=12, you need to add pluses inside x to make the equation correct. In our example “111=12” we can add a plus like this → “11+1=12” & the equation becomes correct. You need to find the minimum number of pluses to add to x to make the equation correct. If there is no answer then print -1.

Input : A string `s`

which is the equation

Constraints: `1<=len(s)<=1000`

The value of y does not exceed `5000`

?

Q2-

There is a unique ATM in wonderland. Imagine this ATM as array of numbers. You can withdraw cash only from either ends of the array. Sarah wants to withdraw X amount of cash from the ATM. What are the minimum number of withdrawals Sarah would need to accumulate X amount of cash . If not possible print -1.

Constraints : `1<=N<=1e5`

`1<=A[i]<=1e5`

`1<=X<=1e5`

I have an `O(n^2)`

approach for 2nd ques i guess, but is there any better way.

P.S These questions are from Infosys sample test for HackwithInfy and not from ongoing contest…

source:

`https://infytq.onwingspan.com/en/page/home`