Loading video...

Video Failed to Load

Go Home

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 views • 1 year ago •via X (Twitter)

10 Comments

louis's profile picture
louis1 year ago

@grok

Kaushal's profile picture
Kaushal1 year ago

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)

TechMaven's profile picture
TechMaven1 year ago

a minimum of 1000 checks is necessary

JK's profile picture
JK1 year ago

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

placoo's profile picture
placoo1 year ago

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.

AIGIRL's profile picture
AIGIRL1 year ago

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

Loksly's profile picture
Loksly1 year ago

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.

Metal.Bot's profile picture
Metal.Bot1 year ago

499 if previous librarians were sober, else 999

Paul Thomas 💙's profile picture
Paul Thomas 💙1 year ago

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

dinn's profile picture
dinn1 year ago

Devide and conquer

Related Videos