For a challenge, I'm trying to return the unique values of an array without using
uniq. This is what I have so far, which doesn't work:
unique_arr = 
input_arr.each do |word|
if word != unique_arr.last
input = gets.chomp
input_arr = input.split.sort
My reasoning here was that if I sorted the array first before I iterated through it with
each, I could
push it to
unique_arr without repetition being a possibility considering if it's a duplicate, the last value pushed would match it.
Am I tackling this the wrong way?