From 7bfac76e59fbbc32c846ef9f0ea9b180c1438f2d Mon Sep 17 00:00:00 2001
From: fartem <jaman.smlnsk@gmail.com>
Date: Tue, 22 Apr 2025 07:07:07 +0300
Subject: [PATCH] 2025-04-22 v. 9.3.1: added "2951. Find the Peaks"

---
 README.md                             |  1 +
 leetcode-ruby.gemspec                 |  2 +-
 lib/easy/2951_find_the_peaks.rb       | 14 ++++++++++++++
 test/easy/test_2951_find_the_peaks.rb | 25 +++++++++++++++++++++++++
 4 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 lib/easy/2951_find_the_peaks.rb
 create mode 100644 test/easy/test_2951_find_the_peaks.rb

diff --git a/README.md b/README.md
index e3ea1eb..f8c7ecf 100644
--- a/README.md
+++ b/README.md
@@ -454,6 +454,7 @@ Profile on LeetCode: [fartem](https://leetcode.com/fartem/).
 | 2544. Alternating Digit Sum                                        | [Link](https://leetcode.com/problems/alternating-digit-sum/)                                        | [Link](./lib/easy/2544_alternating_digit_sum.rb)                                        | [Link](./test/easy/test_2544_alternating_digit_sum.rb)                                        |
 | 2549. Count Distinct Numbers on Board                              | [Link](https://leetcode.com/problems/count-distinct-numbers-on-board/)                              | [Link](./lib/easy/2549_count_distinct_numbers_on_board.rb)                              | [Link](./test/easy/test_2549_count_distinct_numbers_on_board.rb)                              |
 | 2652. Sum Multiples                                                | [Link](https://leetcode.com/problems/sum-multiples/)                                                | [Link](./lib/easy/2652_sum_multiples.rb)                                                | [Link](./test/easy/test_2652_sum_multiples.rb)                                                |
+| 2951. Find the Peaks                                               | [Link](https://leetcode.com/problems/find-the-peaks/)                                               | [Link](./lib/easy/2951_find_the_peaks.rb)                                               | [Link](./test/easy/test_2951_find_the_peaks.rb)                                               |
 | 2974. Minimum Number Game                                          | [Link](https://leetcode.com/problems/minimum-number-game/)                                          | [Link](./lib/easy/2974_minimum_number_game.rb)                                          | [Link](./test/easy/test_2974_minimum_number_game.rb)                                          |
 | 3083. Existence of a Substring in a String and Its Reverse         | [Link](https://leetcode.com/problems/existence-of-a-substring-in-a-string-and-its-reverse/)         | [Link](./lib/easy/3083_existence_of_a_substring_in_a_string_and_its_reverse.rb)         | [Link](./test/easy/test_3083_existence_of_a_substring_in_a_string_and_its_reverse.rb)         |
 | 3090. Maximum Length Substring With Two Occurrences                | [Link](https://leetcode.com/problems/maximum-length-substring-with-two-occurrences/)                | [Link](./lib/easy/3090_maximum_length_substring_with_two_occurrences.rb)                | [Link](./test/easy/test_3090_maximum_length_substring_with_two_occurrences.rb)                |
diff --git a/leetcode-ruby.gemspec b/leetcode-ruby.gemspec
index afbccf1..efbe728 100644
--- a/leetcode-ruby.gemspec
+++ b/leetcode-ruby.gemspec
@@ -5,7 +5,7 @@ require 'English'
 ::Gem::Specification.new do |s|
   s.required_ruby_version = '>= 3.0'
   s.name = 'leetcode-ruby'
-  s.version = '9.3.0'
+  s.version = '9.3.1'
   s.license = 'MIT'
   s.files = ::Dir['lib/**/*.rb'] + %w[README.md]
   s.executable = 'leetcode-ruby'
diff --git a/lib/easy/2951_find_the_peaks.rb b/lib/easy/2951_find_the_peaks.rb
new file mode 100644
index 0000000..6e82c5a
--- /dev/null
+++ b/lib/easy/2951_find_the_peaks.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+# https://leetcode.com/problems/find-the-peaks/
+# @param {Integer[]} mountain
+# @return {Integer[]}
+def find_peaks(mountain)
+  result = []
+
+  (1...mountain.size - 1).each do |i|
+    result << i if mountain[i] > mountain[i - 1] && mountain[i] > mountain[i + 1]
+  end
+
+  result
+end
diff --git a/test/easy/test_2951_find_the_peaks.rb b/test/easy/test_2951_find_the_peaks.rb
new file mode 100644
index 0000000..de021f3
--- /dev/null
+++ b/test/easy/test_2951_find_the_peaks.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+require_relative '../test_helper'
+require_relative '../../lib/easy/2951_find_the_peaks'
+require 'minitest/autorun'
+
+class FindThePeaksTest < ::Minitest::Test
+  def test_default_one
+    assert_equal(
+      [],
+      find_peaks(
+        [2, 4, 4]
+      )
+    )
+  end
+
+  def test_default_two
+    assert_equal(
+      [1, 3],
+      find_peaks(
+        [1, 4, 3, 8, 5]
+      )
+    )
+  end
+end