Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
quil
Weird behavior when running C#

quil

Feb 26, 2024

I had the same code as the solution except that in the Swap function I used the same int array name "nums" and it had weird behavior where the last entry is incorrect. When I changed it to a different name, like "arr" in the solution, it worked fine. I'm not sure if there is some hidden global variable names "nums" that is causing this weird behavior?

I thought I was going crazy because I couldn't find any difference in the logic of the code.

0

0

Comments
Comments

On this page