Mobile Development 26 min read

Ace iOS Interviews: Real Baidu & NetEase Experiences and Proven Tips

This article shares a detailed iOS interview journey—including Baidu, NetEase, and Alibaba rounds—along with algorithm questions, Objective‑C runtime insights, practical coding challenges, and actionable preparation strategies to help developers land their dream mobile development jobs.

21CTO
21CTO
21CTO
Ace iOS Interviews: Real Baidu & NetEase Experiences and Proven Tips

Introduction

With the spring recruitment season in full swing, I joined Baidu and decided to share my interview experiences, preparation methods, and useful advice for iOS developers aiming for large tech companies.

My Interview Experience

Baidu

First Round (≈1.5 h)

Four algorithm questions:

Swap(a, b) without a temporary variable – use addition or XOR.

Search a number in a 2‑D sorted array – "剑指 Offer" question 3.

Find the top‑10 users with most logins in a billion‑record log – hash table + red‑black tree ("剑指 Offer" question 30).

Describe sorting algorithms – quicksort (partition), heap sort (unstable), merge sort, radix sort.

A logic puzzle followed, then open‑ended iOS questions:

Difference between load and initialize in Objective‑C.

Understanding blocks – three types, stack‑to‑heap copy, copy attribute, retain‑cycle causes and solutions.

Runtime basics – method lookup cache, message forwarding, object memory layout.

MVC vs. MVVM – why MVC can become bulky and how MVVM separates concerns.

UITableView optimization – Instruments profiling, estimating row height, caching during idle run‑loop.

ARC fundamentals – compiler‑injected retain/release, property attributes, memory‑leak scenarios.

The first round focused on basic algorithms and Objective‑C; I answered about 80% correctly.

Second Round (≈0.5 h)

Self‑introduction followed by three questions:

What is a dangling pointer in iOS and when does it occur?

Explain blocks (revisited from the first round).

How did you optimize UITableView?

The interview repeated many first‑round topics.

Third Round – On‑site in Beijing (≈2.5 h)

One hour of handwritten algorithms:

Validate whether a string is a legal IP address (e.g., "192.168.1.1").

Implement big‑integer addition.

Could not finish the big‑integer task due to handling negatives.

TCP handshake and teardown explanation – why three‑way handshake and four‑way teardown.

Design problem: quickly search a phone number list of 100 k entries by a substring. Initial solution: linear scan with KMP (slow). Proposed index‑based approach: create 100 indexes (00‑99) to narrow search, improving speed ~100× but increasing storage.

Considered a trie as a better solution.

Question about adding nil to an Objective‑C array – it terminates the array, preventing further inserts.

NetEase

Written Test

Mixed topics (OS, networking, mobile, algorithms). Three coding tasks:

DFS‑style problem (unsolved due to time).

Reverse a URL like "www.zhidao.baidu.com" to "com/baidu/zhidao/www" – two reversals.

Find all sub‑arrays summing to a target value – simple recursion.

First Round (iOS focus)

Explain blocks – stack‑to‑heap copy, ARC support since iOS 4/5.

ARC optimizations – example of NSString *s1 = @"hello"; NSString *s2 = s1; s2 = nil;.

Discuss MVVM and ReactiveCocoa – data binding basics.

List used open‑source libraries (Masonry, SnapKit, AFNetworking, etc.).

Can you implement a given feature? – answered honestly.

Read source of SDWebImage – run‑loop usage for smooth scrolling.

Why does SDWebImage decode images after download? – to create a memory‑mapped bitmap.

Other Interview Questions

Alibaba First Round

MVC advantages and communication between modules.

Detect intersection of two infinite (potentially cyclic) linked lists.

UITableView optimizations.

KVO, Notification, delegate pros/cons.

Manually trigger KVO.

Objective‑C copy method.

Difference between SEL and IMP in runtime.

AutoreleasePool usage and principle.

RunLoop implementation and data structures.

Why blocks cause retain cycles.

GCD task coordination (A, B, C → D).

NSOperation vs. GCD.

CoreData multithreading handling.

Design an image cache.

Custom network component design.

Alibaba Second Round

Determine if a cell is visible on screen.

Process vs. thread differences.

TCP vs. UDP differences.

TCP flow control.

Array vs. linked‑list differences.

UIView lifecycle order when navigating between screens.

Block retain‑cycle issues.

ARC essence.

RunLoop sleep mechanism.

When AutoreleasePool releases.

Find first non‑repeating character in a string.

Hash table collision handling.

Interview Takeaways

1. Solving Algorithm Questions

Clarify problem statements with the interviewer, demonstrate communication skills, allocate thinking time wisely, and know when to abandon a hard problem.

2. Handling Unknown Questions

Ask for clarification, explain your reasoning, and admit gaps when necessary; reasoning ability often matters more than the exact answer.

3. Dealing with Unanswerable Questions

Admit honestly; a brief, reasoned explanation is better than fabricating an answer.

4. Preparing a Killer Topic

Choose a deep, practical subject (e.g., UITableView performance) that you have experimented with and can discuss in detail.

5. Mindset

Expect feedback within a few days, follow up politely if needed, and stay calm throughout the process.

Study Resources

Algorithm

Focus on strings, arrays, linked lists, trees, stacks, sorting, and bit‑operations. Recommended books: "剑指 Offer" and LeetCode practice.

Networking Layer

Understand TCP/UDP differences, three‑way handshake, four‑way teardown, flow control, and basic HTTP concepts.

Operating System & Compilation

Review compilation pipeline, virtual memory, linking, process/thread models, synchronization primitives, and concurrency concepts.

Objective‑C

Read "Effective Objective‑C 2.0" and "Objective‑C Advanced Programming"; master ARC, blocks, GCD, runtime, KVO/KVC, and memory management.

iOS Development

Study RunLoop, UITableView optimization, asynchronous image loading, functional/reactive programming, view controller lightweighting, view lifecycle, corner radius tricks, event propagation, and ReactiveCocoa/MVVM basics.

Original source: https://bestswifter.com/bat-interview/ – Author: 张星宇 (@bestswifter)
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Mobile DevelopmentalgorithmiOSSwiftcareerinterviewObjective‑C
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.