Ted Roche wrote on 2016-07-18:
> Hey, spoiler alert!
>
> Guess you'll need to subscribe to Gene's newspapers to find the solution.
>
> By inspection, I can come up with at least one date closer than that.
>
> So, let's think about the *algorithm* to solve the problem in minimal
> time, rather than the answer.
>
>
There are many ways to code searching for this. Here is my solution:
LOCAL ldDate, lnStart, lnStop
lnStart = SECONDS()
ldDate = DATE()
llFound = .F.
DO WHILE NOT llFound
ldDate = ldDate + 1
llFound = NOT HasDuplicates(ldDate)
ENDDO
lnStop = SECONDS()
?ldDate
?lnStop - lnStart
FUNCTION HasDuplicates
LPARAMETERS tdTestDate
LOCAL lcTestDate, llDuplicate
lcTestDate = DTOS(tdTestDate)
llDuplicate = .F.
FOR ii = 0 TO 9
IF LEN(CHRTRAN(lcTestDate, TRANSFORM(ii), ""))<7
llDuplicate = .T.
EXIT
ENDIF
NEXT
RETURN llDuplicate
ENDFUNC
Tracy Pearson
PowerChurch Software
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.