Monday, January 28, 2013

Facebook Hacker Cup: Find the Min

My submitted solution was wrong, but here's the correct (hopefully) solution I came up with after my submission.

Problem: Facebook Hacker Cup 2013 Qualification Round: (45) Find the Min

Solution: Time complexity - O(k) O(k^2)


3 comments:

  1. my version in C:
    http://nopaste.me/paste/1190818255107a72e3b1b9
    execution time : 0.02s

    ReplyDelete
  2. How is it O(k) ?
    the for loop at line 34 has O(k) complexity and the while loop (line 37) inside this for loop has O(k) complexity. So, it has O(k^2) time complexity.

    ReplyDelete