Interview Riddles – Difference of 2 numbers in sorted array



In this episode I solve the ‘Difference of 2 numbers in sorted array’ interview riddle.
The riddle: “Given a sorted array of numbers and a difference D find 2 numbers whose difference is D”
In previos episode I solved the similar riddle, the difference was that the array wasn’t sorted.
When we know this little detail, we can improve our algorythm and make in with constant space.

00:39 Solution motivation
05:02 Solution code
08:39 Examples using Quokka
09:34 Solution overview
11:07 Solution complexity discussion

You can see all the code here:
https://github.com/slavik57/interview-riddles

Interview Riddles:

TypeScript Modules:

Learn TypeScript:


Official Link: Click Here

See also  Who is level 125 walkthrough

Leave a Comment