Snapchat iOS 店面

Mobile iOS
地点在 SF Bay Area

After the general intro ( interviewer - 5 mins, myself - 7 mins), I was asked some questions about my project and basic iOS questions which lasted for about 10mins. Then I was asked to solve the following problem:

Given a phone number (which is an integer and can assume that there are no spaces and has only numbers) and a target number, give the output as string where we can do any mathematical operation like /, *, + or - and it should match the target number.

i/p: 7123456 target: 426
o/p: 7/1*2*3*4*5+6

I had 30 mins to do this and I explained how I would go about, first generating the combinations of the string and then using DFS/BFS to insert each operation and see whether it can be achieved.

And also wrote the signature of evaluateString which would do the mathematical operation to check whether it is equal to target. I explained how we can use stack to do this one…

Overall it was very hard.