News for hackers. Stuff that matters.
Re:Embedded PDF viewer in Firefox 81 supports filling forms by vcxy on Tuesday September 22, 2020 @12:44PM (#24556728)
"Find the earliest valid pdf in consecutive digits of pi"
Re:Embedded PDF viewer in Firefox 81 supports filling forms by paulmd on Tuesday September 22, 2020 @01:15PM (#24557199)
I mean, the answer is trivially zero, there exists a PDF-like structure somewhere in Pi, and the offset of that doesn't have to be zero, it can start or end anywhere. So the range [0, N] is a valid PDF.
Re:Embedded PDF viewer in Firefox 81 supports filling forms by infogulch on Tuesday September 22, 2020 @03:00PM (#24558457)
"Find the last byte of the first valid PDF in the binary digits of Pi"
Re:Embedded PDF viewer in Firefox 81 supports filling forms by paulmd on Wednesday September 23, 2020 @05:36PM (#24572358)
Since the PDF also doesn't have to be end-aligned, the answer is trivially [0, infinity].

The first place a valid PDF could be ended, perhaps.

Re:Embedded PDF viewer in Firefox 81 supports filling forms by infogulch on Wednesday September 23, 2020 @10:20PM (#24574663)
A pdf at [0, N] sorts before the one at [0, N+1], by "first valid pdf".
Re:Embedded PDF viewer in Firefox 81 supports filling forms by paulmd on Friday September 25, 2020 @12:17PM (#24591384)
No, both start at 0. Also, [0, infinity] and [0, infinity+1] are the same thing.
Re:Embedded PDF viewer in Firefox 81 supports filling forms by infogulch on Tuesday September 29, 2020 @02:11AM (#24624615)
Re:Embedded PDF viewer in Firefox 81 supports filling forms by paulmd on Tuesday September 29, 2020 @01:24PM (#24630512)
your example fails to satisfy the invariant. 11 is less than infinity.

you're just pasting random python snippits at me now. It's time to move on.

again, just to summarize: PDF files do not have to be zero aligned, and they do not have to be end aligned. Therefore the answer to the question "what is the first segment of Pi that is a valid PDF file" is trivially (0,infinity). That is a correct statement. The non-greedy (in the regex sense) answer to that question will be different, however.

Re:Embedded PDF viewer in Firefox 81 supports filling forms by infogulch on Tuesday October 06, 2020 @02:06PM (#24700645)
Why is this so hard? If the tuple (0,10) represents the range of a valid pdf, then the next tuple (0,11) is also a valid pdf. Or any after it up to and including (0,infinity).

Note the word "next", implying that (0,10) sorts before (0,11); you even say it yourself "11 is less than infinity". Where I'm from "first" and "less" are related (the first element in a unique sorted list is defined to be less than all other elements). So if there is any valid pdf in pi that can be identified by the range tuple (0,N), then the first valid pdf must occur before N -> infinity. Therefore (0,infinity) can never be the first valid pdf, even though it may be a valid pdf.

Maybe a picture would help:

    Potential pdf file ranges in pi: [(0,0),(0,1),(0,2),(0,3),(0,4),...,(0,N-1),(0,N),(0,N+1),(0,N+2),...,(0,infinity)]
    Is it a valid pdf?                 no    no    no    no    no  (no)  no      yes   yes     yes   (yes) yes
    Which one is first?                                                          ^^^
I thought linking to a python script that shows the order comparison of a tuple (0,N) as less than the tuple (0,N+1) would clearly demonstrate this, but it appears to have failed to communicate that to you. We don't need non-greedy regex rules to do a less than comparison.
Re:Embedded PDF viewer in Firefox 81 supports filling forms by drevil-v2 on Tuesday September 22, 2020 @03:41PM (#24558914)
Please don't give them any ideas.. the whiteboard interview coding tests are hard enough as it is
Re:Embedded PDF viewer in Firefox 81 supports filling forms by gedy on Tuesday September 22, 2020 @07:05PM (#24561052)
How else will we weed out the fakers and people coasting for 10 years? Our CRUD SaaS app needs top people.
Re:Embedded PDF viewer in Firefox 81 supports filling forms by ehsankia on Tuesday September 22, 2020 @07:01PM (#24561020)
Doesn't sound like that hard of a question, given you are provided the structure of the PDF header. I guess it really comes down to substring search.
Re:Embedded PDF viewer in Firefox 81 supports filling forms by btown on Tuesday September 22, 2020 @01:06PM (#24557056)
Imagine if it was a PDF that simply rendered the number 42.
Re:Embedded PDF viewer in Firefox 81 supports filling forms by ddalex on Tuesday September 22, 2020 @06:42PM (#24560868)
If that happens we know for a fact that we are in a simulation