Top 5 Dynamic Programming Problems for iOS Interviews

Wayne Bishop
Swift Algorithms & Data Structures
2 min readSep 29, 2021

In its simplest form, Dynamic programming relies on data storage and reuse to increase algorithm efficiency. Most questions in computer science are solved using various forms of dynamic programming. The trick is recognizing when optimal solutions can be devised using a simple variable or require the use of a sophisticated data structure or algorithm.

Memoization

The process of data reuse is also called memoization and can take many forms. As we’ll see, this style of programming provides numerous benefits.

If you’ve purchased something through Amazon, you’ll be familiar with the site term — save for later. As the phrase implies, shoppers can add items to their cart or save them to a wish list for later viewing. When writing algorithms, we often face a similar choice of completing actions (performing computations) as data is being interpreted or storing the results for later use. Examples include retrieving JSON data from a RESTful service or using the Core Data Framework:

In iOS, design patterns can help us time and coordinate how data is processed. Specific techniques include multi-threaded operations ( structured concurrency ), notifications, and delegation. On the other hand, dynamic programming isn’t necessarily a single coding technique but rather how to think about actions (e.g., subproblems) that occur as a function operates. The resulting DP solution could differ depending on the problem.

The following are the top 5 problems that can be solved using Dynamic programming:

  1. Count of Occurrences
  2. Counting Sort Algorithm
  3. Fibonacci Revised
  4. Longest Subsequence
  5. Pair of Numbers

Other well-known algorithms that also apply dynamic programming include PageRank as well as Dijkstra’s Shortest Path. These two algorithms alone power many of the online tools and processes we use today.

Other Study Lists

Thanks for checking out my dynamic programming list! If you haven’t already, be sure to also review my other lists as they relate to computer science and Swift / iOS development.

--

--