Verily Life Sciences
1 questions · 1 experiences · 1p3a (2)
Verily Onsite Interview Coding Challenge: Fun with Doubles
Question Details
Completed an onsite for Verily pretty recently and got asked this pretty interesting problem in one of the rounds. ## Fun with Doubles ### Part 1 Given an array arr of integers, double each element and concatenate. For example, [1, 2, 4] --> [1, 2, 4, 2, 4, 8] notice the pattern in the output? ### Part 2 Given an output that may or may not come from part 1, identify the inverse. python [1, 2, 4, 2, 4, 8] --> [1, 2, 4] [4, 2, 8, 16] --> [2, 8] [1, 4] --> NO INVERSE ## Reflection * Part 1 as you may expect is very straightforward. spend at most 5 minutes on coding it up * I sort of got stuck on the thought process for part 2. I think I had the idea of "pairing things up", but I had a tricky bug in my implementation * In hindsight, I realized that the implementation was really straightforward and I sort of overcomplicated it. Interviewer said that "I was pretty close and with minor updates, I would have gotten it" * 50/50 on if I'll move forward