Dec-08-2016, 07:30 PM
ndb[i] = v
is where your problem lies. Your output always has Buzz in the right places, but you never see Fizz. That's because you always compare Fizz first, set it where it needs to be, and then compare for Buzz and overwrite whatever you did for Fizz.One possible solution would be to do
ndb[i] = ""
before you iterate over the db, and then when a match is found, you simply add it to whatever was already there with +=
.