Five programming problems every Software Engineer should be able to solve in less than 1 hour

Mark Waddingham mark at livecode.com
Sun May 10 12:18:33 EDT 2015


On 2015-05-10 17:42, Geoff Canyon wrote:
> I rewrote the function to take arbitrary arguments for the list of 
> numbers
> and the target value, and then took advantage of the fact that char 0 
> of
> "+-" is empty:

That's neat - I wonder what the limits in terms of tractable computation 
the approach has on modern hardware.

In regards to the 'char 0 of' something being empty, I decided not to do 
it that way for clarity mainly. In developing LCB (which is an attempt 
to make a strict version of LCS, essentially) many questions have come 
up (as I'm sure Peter could comment on at length) as to what one should 
really think of as being 'correct'.

On the one hand LCS is very forgiving as it makes (what some might say) 
are 'sensible' defaults in edge-case conditions; on the other hand LCB 
is not at all forgiving as it expects you to be precise. There is a 
balance to be struck here in terms of making things 'easy' (which is, to 
be fair, a rather ill-defined property in this context)...

Too lax and it is too easy to make hard to detect logic errors in code, 
too strict and it makes writing the code more difficult and frustrating 
and verbose.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list