Created
March 29, 2019 02:22
-
-
Save wyukawa/6d431130991dfb819f25b5e230215689 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import edu.princeton.cs.algs4.StdIn; | |
public class Permutation { | |
public static void main(String[] args) { | |
int k = Integer.parseInt(args[0]); | |
RandomizedQueue<String> randomizedQueue = new RandomizedQueue<>(); | |
while (!StdIn.isEmpty()) { | |
String str = StdIn.readString(); | |
randomizedQueue.enqueue(str); | |
} | |
for (int i = 0; i < k; i++) { | |
System.out.println(randomizedQueue.dequeue()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment