• Shaarli
  • Tag cloud
  • Picture wall
  • Daily
  • RSS
  • Login
4251 shaares
Filters

My Google Coding Interview Question | by William Wen | CodeX | May, 2022 | Medium

QRCode

Given a positive sorted array a = [ 3, 4, 6, 9, 10, 12, 14, 15, 17, 19, 21 ];
Define a function f(a, x) that returns x, the next smallest number, or -1 for errors.
i.e.
f(a, 12) = 12
f(a, 13) = 12

Why Binary Search?

Binary search is one of the most difficult “simple” coding problems. The algorithm looks trivial, but it’s a devil to implement. Jon Bentley, a former CMU professor, wrote in his book Programming Pearls that only 10% of professional programmers are able to implement it correctly, including PhD students.

https://medium.com/codex/my-google-coding-interview-question-166f2922b548
May 11, 2022 at 8:58:40 AM EDT *
interviewing programming career
FILLER
Shaarli · The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community · Documentation
Fold Fold all Expand Expand all Are you sure you want to delete this link? Are you sure you want to delete this tag? The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community