You are using an outdated browser. Please update your browser for a better user experience.

Fibonacci

dynamic

The fibonacci sequence is defined by F(n) = F(n-1) + F(n-2), where F(1) = 1 and F(0) = 0. The naive solution (recursive) is quite obvious, but has a runtime of O(2^n) which is bad. Is there a way that you can calculate the sequence in a shorter time?

There are more efficient ways to calcula...

Stonks Time Machine

dynamic

You have recently developed a machine that lets you travel through time. You decide that you want to use your time machine to make yourself a fortune by investing on the stock market. Despite all the effort you put into breaking the laws of physics, you can't be bothered to figure out what stock...

Death Star Deliberation

dynamic

You're Captain Jack, Laser Destruction Coordinator aboard the Death Star. You're a spy for the Rebel Alliance and lately you've been doing more snooping than lasering. In fact you've been slacking so much that you haven't fired a single beam in months. Coming up soon is a board meeting with your...

Subarray with 0 sum

dynamic

Given an array of integers, check if array contains a sub-array having 0 sum.

Input: {3,4,-7,3,1,3,1,-4,-2,-2}

Output: Sub-array with 0 sum exists

The sub-arrays with a sum of 0 are:

{3,4,-7}

{4,-7,3}

{-7,3,1,3}

{3,1,-4}

{3,1,3,1,-4,-2,-2}

{3,4,-7,3,1,3,1,-4,-2,-2}

The prob...