3 Replies
Hello, I have a code that is supposed to return the median of two sorted arrays. This is my code. It doesn't return the median. I tried logging my mergedArray to the console. The output in my console should be:
1
2
3
4
5
7
9
10
13
15
17
21
22
23
Instead the console outputs:
1
2
3
4
5
7
9
13
15
17
21
22
23
0
The 10 doesn't get Writen in my console and thus also isn't included in my mergedArray for some reason
Btw I know that my code is very ugly and not optimal, but I am primarily trying to look for the reason why the number 10 isn't included in my merged array. So far I tried asking chatgpt, claude and grok, but none of these AIs seem to know why the 10 isn't included.
to start with, have you tried debugging this to see what is happening in your program? Much easier to find bugs when you can step through each statement and find where things don't behave correctly
Unknown User•5w ago
Message Not Public
Sign In & Join Server To View