Expression Add Operators, is a LeetCode problem from graphs subdomain. This problem has also been asked in companies like Facebook during the interview. In this post we will see how we can solve this challenge in Swift

Problem Description

You can find the full details of the problem Expression Add Operators at LeetCode

Solution

length of the string num, add to result when eval is equal to target

Note:

  1. String cast to Integer will make character loss, e.g. "05" -> 5

  2. Multiplication's priority is higher than addiction

Time Complexity: O(n^n), Space Complexity: O(n)

Please check the main.swift snippet for the solution.

This solution originally posted at: Github by @soapyigu