Skip to main content
13 events
when toggle format what by license comment
Sep 28, 2019 at 14:30 vote accept newbie
Sep 28, 2019 at 14:29 comment added newbie It did. Considering the fact that overflow checking was unnecessary, made me realize code was perfectly fine without it when I moved if ( pairOfPassingCars > 1000000000 ) { return OVERFLOW; } up. It used to be at the bottom, and returned OVERFLOW if that was true, or pairsOfPassingCars otherwise... That's what made me check
Sep 28, 2019 at 14:25 comment added dfhwze I'm sticking to this version of the code. Hope it helps you.
Sep 28, 2019 at 14:20 review Suggested edits
Sep 28, 2019 at 16:40
Sep 28, 2019 at 14:14 history edited dfhwze CC BY-SA 4.0
compilation error fix
Sep 28, 2019 at 14:12 comment added newbie I was editing (I'm new so I forget about pressing Shift+Enter, when trying to nbsp). Not an important error at all! And of course, I like another point of view (otherwise, why posting here?), and tool for handling overflows :-) If there's another way of doing it (according to the uint part), then I totally get it. My question is, is that way better? I mean you say I can avoid Checked... should I? and why? And the ArgumentNullException I think is unneeded in this context, even though if in general it's a good practice I should follow, then I get it too.
Sep 28, 2019 at 14:02 comment added newbie I appreciate the comments. So thanks for that, although codility's compiler throws the following error: "Solution.cs(32,16): error CS0266: Cannot implicitly convert type uint' to int'. An explicit conversion exists (are you missing a cast?)" After that, adding the cast (int), does pass the tests with 100% final score. The other thing I don't get is why would you throw an ArgumentNullException when just returning that 0 pairsOfPassingCars have been found is OK, and the foreach wouldn't even have to iterate through an empty array? so, no improvement in performance, nor result. Thanks again.
S Sep 28, 2019 at 13:48 history suggested DBro CC BY-SA 4.0
Corrected casing of WEST to West.
Sep 28, 2019 at 13:46 review Suggested edits
S Sep 28, 2019 at 13:48
Sep 28, 2019 at 8:49 history edited dfhwze CC BY-SA 4.0
deleted 2 characters in body
Sep 28, 2019 at 8:40 history edited dfhwze CC BY-SA 4.0
added 19 characters in body
Sep 28, 2019 at 8:32 history edited dfhwze CC BY-SA 4.0
added 1422 characters in body
Sep 28, 2019 at 8:26 history answered dfhwze CC BY-SA 4.0