Skip to content

Commit

Permalink
Rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
beauttie committed Apr 22, 2021
1 parent 856257f commit 2f3bcca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/exercises.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def top_k_frequent_elements(list, k)

k_dup = k.dup
k_most_frequent = []
max_count.downto(1) do |key|
if inverted_hash[key]
inverted_hash[key].each do |int|
max_count.downto(1) do |count|
if inverted_hash[count]
inverted_hash[count].each do |int|
k_most_frequent << int if k_dup > 0
k_dup -= 1
end
Expand Down

0 comments on commit 2f3bcca

Please sign in to comment.