Photo from Pixabay

iOS Interview Prep Guide: 30-Day Code Challenge in Swift — Week 5/5

Michael T. Ho
The Startup
Published in
5 min readMay 16, 2020

--

This is the last week of the 30-Day Code Challenge. I hope you feel your iOS and Swift skills have extended to the next level. Anyway, good job to those developers sticking around this.

If you miss the articles for the previous weeks, here’s the compilation of them — Week 1, Week 2, Week 3, and Week 4. All solutions and unit tests are up to my Github repo, feel free to use them for your interview preparation.

The following are the remaining 2 coding questions of the challenge that we are going to cover in this article.

  1. Binary Tree Maximum Path Sum (Solution) 🥇
  2. Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree (Solution) 🥈

(🥇 🥈 indicate writer’s selection of high-frequency interview questions.)

Binary Tree Maximum Path Sum

🥇 Writer’s selection of the week

Description: Given a non-empty binary tree, find the maximum path sum. A path is defined as any sequence of nodes from some starting node to any node in the tree along with the parent-child connections. The path must contain at least one node and does not need to go through the root.

Example 1

--

--