Member-only story

Did You See This? A Measurement Class In Swift

Look, I didn’t know it was there

Steven Curtis
4 min readDec 11, 2022
Photo by Diana Polekhina on Unsplash

Difficulty: Beginner | Easy | Normal | Challenging

You might be aware that I’m not the biggest fan in the world of the https://leetcode.com website, as it encourages a reduction of programming into small pseudo-academic exercises.

However, I DO complete those challenges on occasion. This isn’t just to be interview ready, it is also to give myself every opportunity to learn new things in the Swift language.

Today, just that happened.

The Problem

You might well laugh at this one. It’s a simple LeetCode problem and the website categorises this as “easy”. It’s number 2469, and is based on converting a temperature from Celsius to Kelvin and Fahrenheit.

You’re even given the algorithm (it’s really a sum) to convey how to derive Kelvin and Fahrenheit from Celsius.

- Kelvin = Celsius + 273.15

- Fahrenheit = Celsius * 1.80 + 32.00

which is no problem at all (right?)

However, I wanted to see if there is some other way of completing this challenge.

Measure Solution

--

--

No responses yet