From b3883bd4d4b76ce28f4d2afde765d72e7e4380c9 Mon Sep 17 00:00:00 2001 From: "Charles-A. Francisco" Date: Thu, 17 Oct 2024 20:04:03 -0700 Subject: [PATCH] Temperatures --- puzzles/ruby/temperatures/README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/puzzles/ruby/temperatures/README.md b/puzzles/ruby/temperatures/README.md index ec20c02..8fea628 100644 --- a/puzzles/ruby/temperatures/README.md +++ b/puzzles/ruby/temperatures/README.md @@ -10,15 +10,7 @@ The challenge consists of writing a program that takes as input the list of temp ## Solution Overview -The algorithm processes a list of integer temperatures to find the one closest to zero. Here's a step-by-step breakdown: - -1. **Read Input**: It first reads the number of temperatures and the temperatures themselves from standard input. The temperatures are converted into an array of integers. - -2. **Initialize Variables** - -3. **Iterate Over Temperatures** - -4. **Output the Result** +The solution to this challenge involves iterating over the list of temperatures and keeping track of the absolute difference between each temperature and zero. The closest temperature to zero is the one with the smallest absolute difference. If there are two temperatures with the same absolute difference, the solution should output the positive one. ## Example Input/Output