CodeFighter
Menu

nearestGreater

Jan 1, 2018

If you can’t do linear time, try solving this in quadratic time. Then come back for a linear time solution.

calculateBasins

Dec 24, 2017

A problem which looks harder than it is. Try solving it on your own then check out this simple solution.

knighOnBoardProbability

Dec 23, 2017

An elegant dynamic programming based top-down solution.

nQueens

Dec 22, 2017

Try to solve it yourself first, maybe using a simple brute force solution. Then check this post.

countInversions

Dec 21, 2017

If you need a hint, think of sorting algorithms. Once you’re done, come check out a simple solution.

productExceptSelf

Dec 19, 2017

A solution using Horner’s method, and dynamic programming.

minimumNumberOfBoxes

Dec 19, 2017

Request: Give your best effort to solve it yourself before viewing the solution below.