Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Problems/Daily-Temperatures/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Daily Temperatures

You are given an array of integers temperatures where temperatures[i] represents the daily temperatures on the ith day.
Return an array where output[i] is the number of days after the ith day before a warmer temperature appears on a future day. If there is no day in the future where a warmer temperature will appear for the ith day, set output[i] to 0 instead.

## Documentation

### Solution Idea & [Implementation](./solver.ts)

The idea is straightforward:

Loop over each number in the array.
For every number, start a second loop that goes through the remaining elements of the array, beginning at the next index.

In this inner loop, check each number until you find one that is greater than the current number.
Count how many steps it takes to find such a number.

- If a larger number is found, return the number of steps taken.
- If the end of the array is reached without finding a larger number, return `0`.

Repeat this process for every number in the array.

(Sorry for only one text. But don't want to write two :|)

---

### Information's

This problem comes from the newsletter [Sloth Bytes](https://slothbytes.beehiiv.com).
[Post](https://slothbytes.beehiiv.com/p/docker-for-dummies) from March 25, 2026.
16 changes: 16 additions & 0 deletions Problems/Daily-Temperatures/daily temperatures.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, expect, it } from "vitest";
import dailyTemperatures from "./solver";

describe("Should return the correct days it takes to the next warm day", () => {
it("should return [1, 4, 1, 2, 1, 0, 0] for the first input", () => {
expect(dailyTemperatures([30, 38, 30, 36, 35, 40, 28])).toEqual([1, 4, 1, 2, 1, 0, 0]);
});

it("should return [0,0,0] for the second input", () => {
expect(dailyTemperatures([22, 21, 20])).toEqual([0, 0, 0]);
});

it("should return [1, 4, 1, 2, 1, 0, 0] for the first input", () => {
expect(dailyTemperatures([30, 38, 30, 37, 35, 40, 28])).toEqual([1, 4, 1, 2, 1, 0, 0]);
});
});
7 changes: 7 additions & 0 deletions Problems/Daily-Temperatures/solver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function dailyTemperatures(temps: number[]): number[] {
return temps.map((temp, i) => {
for (let index = i + 1; index < temps.length; index++) if (temp < temps[index]) return index - i;

return 0;
});
}
4 changes: 3 additions & 1 deletion Problems/Vertical-List/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ If it does not exist, we know that the previous word was shorter, so we insert a

By doing this for every word and every character, the solution array is built correctly and the final transformed text can be returned.

(Sorry for only one text. But don't want to write two :|)

---

### Information's

This problem comes from the newsletter [Sloth Bytes](https://slothbytes.beehiiv.com).
[Post](https://slothbytes.beehiiv.com/p/why-your-delete-button-is-a-lie) from May 18, 2026.
[Post](https://slothbytes.beehiiv.com/p/why-your-delete-button-is-a-lie) from March 18, 2026.
2 changes: 1 addition & 1 deletion Problems/Vertical-List/vertical-list.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import verticalTxt from "./solver";

describe("Description for the tests", () => {
describe("Returns the same Text written from up to down", () => {
it("should return a 2x7 Matrix for 'Holy bananas'", () => {
expect(verticalTxt("Holy bananas")).toEqual([
["H", "b"],
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ This repository is about solving coding-problems. It contains famous (or not tha

## Problems

Solved: **27 problems**
Solved: **28 problems**

🟢 Easy: 21
🟢 Easy: 22
🟠 Medium: 5
🔴 Hard: 1

Expand Down Expand Up @@ -41,6 +41,7 @@ Solved: **27 problems**
| [Missing Number](./Problems/Missing-Number/README.md) | 🟢 Easy |
| [Seven Boom!](./Problems/Seven-Boom/README.md) | 🟢 Easy |
| [Vertical List](./Problems/Vertical-List/README.md) | 🟢 Easy |
| [Daily Temperatures](./Problems/Daily-Temperatures/README.md) | 🟢 Easy |

<!-- PROBLEMS_END -->

Expand Down
Loading