DEV Community

Discussion on: Reintroducing Code Review with an Interview Question Asked at Amazon

Collapse
 
dbenchi profile image
David BENCHI

Hello,
I did not tried to optimize my solution (cause I really do not have time). But I really liked the idea of this challenge so I gave it a hit.

Here is my solution

Collapse
 
cindyytong profile image
Cindy Tong

@dbenchi
Hi David! Nice work here. Love that you went beyond the ask and even added the frontend for this. Some things to consider for the future:

  1. What happens if we call arrayAddition([1,1])?
  2. What if we wanted to eliminate complexity a bit and minimize the number of new arrays we're creating. How could this be solved without using flat() or filter()?

We'll be posting our approach to this problem tomorrow. Looking forward to seeing more solutions/thoughts from you throughout our series.

Collapse
 
dbenchi profile image
David BENCHI • Edited
  1. fixed
  2. we could do so by determining in advance the different combination we have. SO we may apply this combination on the original input directly.

Now I follow you on dev.to..... So I will try to answer new challenges if I have time.
Thanks a lot