Posts in category 'algorithms'
This one shows up in online coding assessments under the name Items in Containers, and it’s a trap: the obvious solution passes the examples and then times out on the...
Four nested loops solve this problem in five minutes, and that’s exactly the trap. With up to 1,000 prices per category, brute force has to check 10¹² combinations. Here’s how...
You’ve written a hundred articles, and you want a bot to share one of them every three hours, even while you sleep. “Pick a random article” sounds like one line...
This problem looks easy, and most candidates find the right idea within minutes. Then many of them implement it in a way that passes the examples and fails on half...
Merging two sorted lists is one of the classic coding interview problems, and one of the most useful: it is the heart of merge sort, of merging k sorted lists,...
Big O Notation is a mathematical notation that helps us analyze how complex an algorithm is in terms of time and space. When we build an application for one user...
Depth-First Search (DFS), is an algorithm to search for information in Graphs.
Tree data structures are non-linear data structures, and they allow us to implement algorithms much faster than when using linear data structures.
Write a method that, given an original number N, returns the smallest number with the same number of digits.