This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Exercise from http://programmingpraxis.com/2012/11/27/amazon-interview-question/ | |
* Given a million points (x, y), give an O(n) solution to find the 100 points closest to (0, 0). | |
* Well, you have to read "a million" as "n" and "100" as "100". | |
* Uses a heap of size 100. The complexity-theoretic trick is that 100 is a constant here. | |
*/ | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.PriorityQueue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cardgame; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.Arrays; | |
import java.util.Scanner; | |
/** | |
* This class solves the card game problem from Facebook Hacker Cup 2013 round | |
* 1. http://programmingpraxis.com/2013/02/15/facebook-hacker-cup-2013-round-1- |