Member-only story

Avoid Playgrounds, for Swift LeetCode Challenges

Use the macOS Command Line Tool template

Steven Curtis
4 min readApr 12, 2021
Photo by Hudson Roseboom on Unsplash

Taking an example project from LeetCode, I might try to find the answer for 1413. Minimum Value to Get Positive Step by Step Sum.

Now I told a lie, in one of these articles. Specifically in my Playgrounds article I said I don’t use Playgrounds for LeetCode challenges because of the setup. I actually don’t use Playgrounds because sometimes they are slooow, or don’t seem to work for me when I first start a new Playground. I don’t know why, perhaps it’s because I’m using a 2016 MBP? In any case, I really use the macOS Command Line Tool, and set this up with testing.

This article is about how you might do the same.

The supporting video is @https://youtu.be/0CFHNu2vaOE

The problem

Initially the problem is quite confusing.

The description is, to be honest, not that great. So here is my interpretation:

Given an array of Interges called num traverse the array from left-to right keeping a running total. Find an initial number such that the running totol is never less than 1.

The original description is @ https://leetcode.com/problems/minimum-value-to-get-positive-step-by-step-sum/.

--

--

No responses yet