// Given N points in a 2D Plane in a 2D matrix , return total numbers of distinct points
import java.util.*;
import java.lang.*;
import java.io.*;
// The main method must be in a class named "Main".
class Main {
public static int countDistinctPoint(int [][] point ){
int n = point.length;
int count = 0 ;
for(int i=0; i<n ; i++){
boolean isDistinct = true ;
for(int j=i+1 ; j<n ; j++){
if(point[i][0] == point[j][0] && point[i][1] == point[j][1]){
isDistinct = false;
}
}
if(isDistinct){
count++;
}
}
return count ;
}
public static void main(String[] args) {
int [][] point = {
{1,2},
{3,4},
{1,2},
{5,6},
{3,4}
};
System.out.println("Total Count :- " + countDistinctPoint(point));
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: