Phone screen:
- Write a method to detect if a rectangle is inside another rectangle. It takes two parameters: the first one is bigger, and the second one is smaller. Both parameters are
CGRect. Return a boolean.
Next question is LeetCode 408.
Onsite:
-
Write a method to take two strings of numbers with decimals. For example, "12.892347823" and "65655.62". Return the sum of these two numbers as a string. You CANNOT convert the parameters into integers. This is similar to LeetCode 415, but for decimal numbers.
-
Write an Array extension method like func remove(removeArray: [Int]). This method removes the elements in removeArray from the original array. For example, if the array has [1,3,3,4,5,1,6] and removeArray is [1, 3], the method should remove 1 and 3 from the original array, returning [4,5,6].
-
LeetCode 31.
-
LeetCode 1249.
System design:
Design an app similar to Instagram, but users swipe horizontally. The app can swipe automatically every 10 seconds if the user is doing nothing. When a user swipes to the next photo, the timer resets to zero. Also, if a friend has posted a news feed, the server can push it to your app. A new item is inserted to the front of the queue. For example, if the app has items 1,2,3,4,5, and when your friends post items 6 and 7 while you are looking at item 1, your app will display 1, 6, 7, 2, 3, 4, 5. Need to find a way for the server to push to the app (e.g., WebSocket, polling, or push notification). I chose polling. Explain your choice.