In this post, I will share my experience while interviewing for the position of iOS Software Engineer, Singapore. I will reveal the questions they ask. Hopefully it can help you!
I had 2 interviews over Zoom, 45 minutes each, 1 week apart.
Round 1 Preparation
A bit about my career: Over the last 12 years, I worked at 2 startups, but I have never had a technical interview. 😅
To prepare, I research on Glassdoor, and also found a recent post on what to expect for ByteDance (TikTok’s parent).
So I practiced selected LeetCode questions (~10 easy/medium), while skipping those data structure ones that I will never use in my apps.
In the process, I wrote a cheatsheet for working with collection types.
Round 1A: iOS Questions
Yet, my virgin technical interview was not to my expectation.
I expect to do a LeetCode questions dealing with sequences. However, the interviewer started the first 20 minutes asking textbook questions on iOS.
Explain responder chain?
I got it 50% correct, explaining hit testing from the root down to the child view. I stopped there. The interviewer hinted to me that there’s a second part, but I struggled.
Post-mortem: I wrote “The Thing About Responder Chain” in 2016. The second part is finding the “action”.
What’s new in iOS 14?
Recently, I have been playing with LiDAR on my iPhone 12 Pro, but there’s nothing technical to talk about.
I mentioned SwiftUI is “2.0” and is now much better, with LazyVStack
etc. He is not interested.
Then we have awkward silence as I try to recall what else could be interesting (to him).. So I asked if he can kindly point to me a framework? He said “Widget”, and bingo, I know the topic well.
I wrote “Guide to WidgetKit”. But there’s not much to elaborate beyond how it works, the system timeline, and that it uses SwiftUI.
Tell me an experience with optimizing a piece of code.
At this point, I felt I should have prepared better with memorable past experiences. It is difficult for me to recall them out of the blue. I don’t remember the past.
I took a while to think, and nothing much comes to mind. Hence I ended up talking about using Core Image and metal based layer in my most recent app.
What’s the difference between setNeedsLayout, layoutIfNeeded, layoutSubview?
I mixed up between setNeedsLayout
and layoutIfNeeded
@@
How to find out-of-memory crashes when there’s no log from Crashlytics?
I offered a practical solution: replicate the bug with a device! I laughed it off, but the answer he is looking for is using MetricKit.
To conclude, I answered poorly, and hence it is likely why I failed.
Post-mortem: I should have sent him the articles I wrote! I have been too concerned with trying to recall from memory, and forgot to use my resources.
Round 1B: Coding Question
The next 20 minutes was spent working on a coding question, using HackerRank.
A + sum(every digit in A) = B
Given B, print all possible A
Example:
12 + (1 + 2) = 15
123456789 + (1+2+3+4+5+6+7+8+9) = 123456834
I spent the first 5 minutes formulating on paper, trying to find a “mathematic formula”.
Finally, I attempt a brute force method, but with a small bound, as I note that “sum(every digit in A)” is <= 9*numberOfDigits(B).
But I could not get the answer right, even with the simplest example.
Post-mortem: It turned out my use of ^
operator is WRONG, because that’s XOR, not exponential power..
Round 2 Preparation
I was expecting to fail round 1. However, they scheduled me for round 2.
Perhaps they have a minimal of 2 rounds, so as to give candidates another chance to redeem themselves.
Knowing that they will ask textbook questions, I revised those topics by reading my own blog ^^ and continue to practice on LeetCode.
Round 2: Architecture design
The interview is full of surprises. In round 2, there is less textbook question and no coding problem.
The whole 45 minutes is to design an app architecture, with follow-up questions.
Design an app with the classes and inputs (no need actual code). The first screen is a collection of thumbnails, and the API to fetch them provided. When user taps on a thumbnail, show the detail screen with these features: comment, like, share, swipe left/right to next photo.
I write the design on codeshare.io, and along the way he asked:
- How to optimize performance? My ans: Prefetch, reuse cell, cache, async load images
- What is the API page size to request? My ans: Depends on screen size
- What is the cache policy?
- Have you used SDWebImage before?
He also asked more iOS questions.
Tell me about a specific bug which you spent a lot of time to find.
Argh. I struggled to recall, and merely said the worse bugs are the ones that you cannot replicate. If I can replicate, I can fix. He agreed. We LOL-ed.
What are some of the common memory bugs? What tool would you use to find the issue?
I talked about memory leak, and using Instruments. The most common cause is reference cycle, and understanding the timeline of the instance and the closure. An easy solution is use weak self
in every closure :)
At the end of the session, I felt good and thought I aced it this time.
What I learnt about TikTok
There’s not much time for me to ask questions. I did find out these:
- ByteDance is separating TikTok into it’s own entity – standalone codebase (branching off from Douyin), storing data outside China
- Singapore will focus on Instant Messaging module (which I didn’t know they have)
- Singapore has no engineer at the moment
- Many offices in China – Shanghai, Beijing, etc – with many engineers
- 1 office in US, with 20 engineers
Both interviewers are Chinese, based in Shanghai, and they speak good English. I have no problem understanding them at all. They are nice, casual, and friendly. We did laugh at some of my answers!
How to ace the interview?
I am not a fan of solving algorithm problems and memorising textbook type questions. But if you want to get a job with these giants, you have to prepare for them.
- Be familiar with UIKit
- Know how to investigate crashes, find bugs, and squash them using tools
- Prepare stories about your past experiences eg. difficult bugs, optimizing code
- Practice LeetCode coding questions
- Practice designing app architecture and optimizing it
If you find it exciting to be in a new HQ and be a pioneer engineer, consider joining TikTok in Singapore!
It could also be financially rewarding.
The TikTok now is like the early days of Facebook. They are likely going to IPO soon!