• 0
Sign in to follow this  
Followers 0
mmiguel

Removing Numbers

Question

Consider the following list of numbers. Your job is to erase as few of those numbers as possible such that the remaining numbers appear in increasing order.

9 44 32 12 7 42 34 92 35 37 41 8 20 27 83 64 61 28 39 93 29 17 13 14 55 21 66 72 23 73 99 1 2 88 77 3 65 83 84 62 5 11 74 68 76 78 67 75 69 70 22 71 24 25 26

0

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

9 32 34 35 37 41 55 66 72 73 77 83 84

Nice!

That is a different one than what I had in mind, but it is the same length.

Did you use a general purpose algorithm?

0

Share this post


Link to post
Share on other sites
  • 0

the idea is this.

start off with the first number; put it in a list.

if the next number is lower than the largest number in the list, drop down a list, or begin a new one.

if the next number is higher, copy the current list, one with that number, one without.

if a lower level list exceeds a higher level one, you can delete the higher level list.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.