Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by lovasoa

1 year ago

The best solution, that the LLM did not find, is

     def find_difference(nums):
         try: nums.index(3999), nums.index(99930)
         except ValueError: raise Exception("the numbers are not random")
         return 99930 - 3999

It's asymptotically correct and is better than O(n) :p

0 comments

lovasoa

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities