Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const vectorToInt = V => {
- return parseInt(V.reverse().join(''), 2)
- }
- const calculate = (A, B) => {
- if (A === B)
- return A & B
- return calculate(A&B, B-1)
- }
- const f = (A, B) => calculate(vectorToInt(A), vectorToInt(B))
- console.log(f([1,0,1], [1,1,1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement