currentMin was set to -1 initially, this will not do any harm because the x inner loop will always set currentMin to cost at least once, but it looks erroneous because all integers should be positive, 0 is better