From 1c9a26f389a5d62b60a10a7879c0eed848ec8c0f Mon Sep 17 00:00:00 2001
From: Vitor Oliveira <vbrazo@gmail.com>
Date: Sat, 10 Apr 2021 10:41:01 -0700
Subject: [PATCH] Minor changes

---
 data_structures/arrays/next_greater_element.rb | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/data_structures/arrays/next_greater_element.rb b/data_structures/arrays/next_greater_element.rb
index fc71766..0790ab1 100644
--- a/data_structures/arrays/next_greater_element.rb
+++ b/data_structures/arrays/next_greater_element.rb
@@ -18,7 +18,7 @@
 #
 # Input: nums1 = [2,4], nums2 = [1,2,3,4]
 # Output: [3,-1]
-# 
+#
 # Explanation:
 # For number 2 in the first array, the next greater number for it in the second array is 3.
 # For number 4 in the first array, there is no next greater number for it in the second array, so output -1.
@@ -27,18 +27,18 @@
 # @param {Integer[]} nums2
 # @return {Integer[]}
 def next_greater_element(nums1, nums2)
-  nums1.each_with_index do |value, pointer1|
+  nums1.each_with_index do |nums1_value, pointer1|
     max = 0
-    pos_nums2 = nums2.find_index(value)
+    pos_nums2 = nums2.find_index(nums1_value)
 
-    nums2[pos_nums2..nums2.count].each do |value|
-      if value > nums1[pointer1]
-        max = value
+    nums2[pos_nums2..nums2.count].each do |nums2_value|
+      if nums2_value > nums1_value
+        max = nums2_value
         break
       end
     end
 
-    nums1[pointer1] = (nums1[pointer1] < max ? max : -1)
+    nums1[pointer1] = (nums1_value < max ? max : -1)
   end
 
   nums1