From 214465d4d4e9759e761d07fa9d17c883c83baafc Mon Sep 17 00:00:00 2001 From: igor Date: Mon, 21 Apr 2025 17:41:06 -0300 Subject: [PATCH 1/4] feat: solve count the hidden sequences --- README.md | 1 - .../2025-04-21-count-the-hidden-sequences.js | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 leetcode/daily/2025-04-21-count-the-hidden-sequences.js diff --git a/README.md b/README.md index 1448e7f..68ab4f9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ - [Goal](#-goal) - [Create Exercise File Script](#-create-exercise-file-script) - [Folder Structure](#-folder-structure) -- [Português](#-práticas-de-código) --- diff --git a/leetcode/daily/2025-04-21-count-the-hidden-sequences.js b/leetcode/daily/2025-04-21-count-the-hidden-sequences.js new file mode 100644 index 0000000..22e06f0 --- /dev/null +++ b/leetcode/daily/2025-04-21-count-the-hidden-sequences.js @@ -0,0 +1,22 @@ +// Count the Hidden Sequences +// Created on 2025-04-21 + +function solution(differences, lower, upper) { + let minPrefix = 0; + let maxPrefix = 0; + let prefixSum = 0; + + for (let diff of differences) { + prefixSum += diff; + minPrefix = Math.min(minPrefix, prefixSum); + maxPrefix = Math.max(maxPrefix, prefixSum); + } + + const minStart = lower - minPrefix; + const maxStart = upper - maxPrefix; + + const result = maxStart - minStart + 1; + return result > 0 ? result : 0; +} + +console.log(solution([2,2,3], 1, 8)) From f2e7e4f06bee19c2e1a5fc85afadfcab698dfc59 Mon Sep 17 00:00:00 2001 From: igor Date: Mon, 21 Apr 2025 17:49:47 -0300 Subject: [PATCH 2/4] trigger github action From b4b2675239e2d82899ff96f226f4fad51e205a4e Mon Sep 17 00:00:00 2001 From: igor Date: Mon, 21 Apr 2025 17:54:01 -0300 Subject: [PATCH 3/4] trigger github action From 21f090d40204a94c1647ff49d2831b5e6e9273b0 Mon Sep 17 00:00:00 2001 From: Igor Righi Date: Mon, 21 Apr 2025 17:56:44 -0300 Subject: [PATCH 4/4] Update auto-merge.yml --- .github/workflows/auto-merge.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 82cd284..e4eb2bc 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,6 +12,11 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + fetch-depth: 0 # Garante que todas as branches sejam buscadas + + - name: List branches + run: git branch -r # Lista as branches remotas para depuração - name: Set Git user run: | @@ -23,5 +28,5 @@ jobs: - name: Merge daily-leetcode to main run: | - git merge --no-ff daily-leetcode # Mescla a branch daily-leetcode na main - git push origin main # Envia as mudanças para o GitHub + git merge --no-ff daily-leetcode + git push origin main