x404.co.uk http://x404.co.uk/forum/ |
|
Why are some challenges so difficult to grasp http://x404.co.uk/forum/viewtopic.php?f=4&t=14491 |
Page 1 of 1 |
Author: | finlay666 [ Thu Aug 18, 2011 10:11 am ] | |||||||||
Post subject: | Why are some challenges so difficult to grasp | |||||||||
Trying to develop a rounding system that would always round up to the nearest x (50 for example) unless it was a multiple of 50 In a couple of mins I had 3 different solutions and identified the fastest.... yet the dev who it was for still couldnt grasp how it was done best solution I had:
|
Author: | Fogmeister [ Thu Aug 18, 2011 10:17 am ] |
Post subject: | Re: Why are some challenges so difficult to grasp |
If you're always rounding up then that's by far the quickest way. if x = 50 then return = 50. if x = 51 then return = 51 + 50 - (51 modulo 50) i.e. 101 - 1 = 100. |
Author: | finlay666 [ Thu Aug 18, 2011 10:49 am ] | |||||||||
Post subject: | Re: Why are some challenges so difficult to grasp | |||||||||
thought so, also allows for passing a bit in an enum of rounding state (forceup/forcedown/default) then can extend into the realms of the if block there ![]() |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |