Ad
  • Custom User Avatar
    • Ruby 3.0 should be enabled (Refer this & this for more detail)
  • Custom User Avatar

    #1: Since when can stock prices be negative?!

    #2: It's not clarified if you can buy and sell at the same time -- I would say you cannot. However, the Ruby version expects otherwise:

    input = [100, 59, -33, -39]
    Expected: [100, 100, 0], instead got: [-33, -39, -6]
    
    input = [55, 40, -10, -19, -25]
    Expected: [55, 55, 0], instead got: [-19, -25, -6]