Here&#x27;s an O(N) solution to the `findSum` problem in Ruby:<p><pre><code>  def findSum(array1, array2, sum)
    complements = array1.map{|x| sum - x}.reverse

    i = complements.count - 1
    j = array2.count - 1

    while i &gt;= 0 &amp;&amp; j &gt;= 0
      return true if complements[i] == array2[j]

      if complements[i] &gt; array2[j]
        i -= 1
      else
        j -= 1
      end
    end

    false
  end</code></pre>