View pairs.cs
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
/* | |
https://www.hackerrank.com/challenges/pairs | |
Given N integers, count the number of pairs of integers whose difference is K. | |
Input Format | |
The first line contains N and K. | |
The second line contains N numbers of the set. All the N numbers are unique. |
View Dijkstra.java
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
//http://ideone.com/AW2VoY | |
/* package whatever dijkstra w/ priority queue; // don't place package name! */ | |
import java.util.PriorityQueue; | |
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
class Vertex implements Comparable<Vertex> | |
{ |