Video wird geladen...
Video konnte nicht geladen werden
Developers, this algorithmic puzzle will test your problem-solving skills. How efficiently can you verify if 1,000 books are in order? Share your solution and reasoning.
30,327 Aufrufe • vor 1 Jahr •via X (Twitter)
10 Kommentare

@grok

Sequentially compare each book with its immediate neighbor (book i vs book i+1). If any pair is out of the defined sequence, stop; the collection is not in order. If all 999 adjacent pairs are correct, the books are verified as sorted. O(n)

a minimum of 1000 checks is necessary

worst case you’d need to check all 1000 books and compare each to the one before so 999 comparisons butsince you can’t hold two at once you’d keep re-checking the previous one about 1999 checks ... 1 bookmarked 1000 checks

I'm SelinRabo requests Google support to regain access to my Gmail and YouTube account after losing all passkeys, despite trying multiple devices and recovery options.

both scenarios 999 times as you checked 1 to 999 you know the 1000th should be right.

what about check a random one. See it's number, let's say it's X, then check number X mod 1000. If it's sorted, keep till the last one.

499 if previous librarians were sober, else 999

I made it 999, or 998 with the bookmark that saves one check.

Devide and conquer

