Skip to main content
20 events
when toggle format what by license comment
yesterday history edited Sᴀᴍ Onᴇᴌᴀ CC BY-SA 4.0
update formatting, add tag
yesterday answer added chux timeline score: 2
2 days ago answer added Chris timeline score: 2
Dec 16 at 9:32 comment added Davislor if there are no positive numbers, you would also want to track whether zero is in the array, and if every number in the array is negative, you would need the three negative numbers of smallest magnitude.
Dec 16 at 9:28 comment added Davislor To handle negative numbers, you want to accumulate the three positive numbers and the two negative numbers with greatest magnitudes. Compare the products of the two negative numbers and the second- and third-largest positive numbers.
Dec 16 at 2:04 answer added Snowhawk timeline score: 4
Apr 3, 2022 at 12:00 history tweeted twitter.com/StackCodeReview/status/1510587931773358085
Aug 6, 2020 at 20:34 comment added superb rain @Maanlamp Where exactly do you think the OP keeps track of the largest three values? You remember their code doesn't even work, right? Plus they're sorting the entire array, which mine doesn't, and which this question is all about.
Aug 6, 2020 at 19:05 comment added Maanlamp @superbrain The for loop in OP's code that goes from left to right (or 0 to n, because there's no left/right heading in iteration) and keeps track of the largest three values disproves the first part of what you're saying. I do understand what you've said; I just strongly disagree -- if that wasn't obvious (there's irony in there somewhere). You can both understand and disagree.
Aug 6, 2020 at 17:16 comment added superb rain @Maanlamp So you don't understand the OP's code or don't understand what I'm saying. It's not the same.
Aug 6, 2020 at 16:28 comment added Maanlamp @superbrain It's useless because, if I understand OP's code, that's what he has done. Except his way of what you call obvious is apparently not obvious. A useful answer (an actual answer below) would be the few lines that make up your solution -- but you don't do javascript so why even bother... That's like being a rocket scientist and telling an aerospace engineer how to build a plane. Also I fail to see how those upvotes say anything other than that some people agree with the solution being obvious -- which makes their upvotes useless too. Glad you all think it's obvious... now what?
Aug 6, 2020 at 15:28 comment added superb rain @Maanlamp I fail to see how "go left to right and keep track of the largest three values seen so far" isn't helping, and how three people marking my comment as useful means it's useless.
Aug 6, 2020 at 14:41 comment added Maanlamp @superbrain You're on code review... The questions posted here are almost always about the non-obvious way someone solved a problem. Telling someone to "just do the obvious" without any code and/or example isn't helping; it's patronising and at best useless.
Jul 29, 2020 at 0:19 comment added superb rain @myTest532myTest532 Just the obvious, go left to right and keep track of the largest three values seen so far. And I don't do javascript.
Jul 28, 2020 at 21:29 comment added myTest532 myTest532 @superbrain looks like it is wrong. Do you have a solution for it?
Jul 28, 2020 at 21:25 comment added myTest532 myTest532 Let's assume it can't have negative
Jul 28, 2020 at 21:14 comment added superb rain Your result for [5, 4, 3, 2, 1] is [-1, -1, 60, 120, 120]. Why is that correct?
Jul 28, 2020 at 21:11 comment added spyr03 Can the list of integers include negative numbers?
Jul 28, 2020 at 20:57 history edited πάντα ῥεῖ CC BY-SA 4.0
deleted 8 characters in body
Jul 28, 2020 at 20:54 history asked myTest532 myTest532 CC BY-SA 4.0