How to get the following formatted output? - java

I wrote the code to get the following formatted output, but when I enter number of rows in double digits, the output format changes. Why? How can I fix this?
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
Here is my code:
import java.util.*;
class PTri {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the no. of rows for which " +
"triangle has to be constructed");
int numrow = sc.nextInt();
for (int i = 1; i <= numrow; i++) {
for (int j = 1; j <= numrow - i; j++) {
System.out.print(" ");
}
for (int k = 1; k < i * 2; k++) {
System.out.print(Math.min(k, i * 2 - k) + " ");
}
System.out.println();
}
}
}

It's because the value in double digit will change the whole architecture.The set will shift to right one place. So you can put a condition like this. I have added one extra space between numbers to improve visibility.
import java.util.*;
class PTri {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the no. of rows for which " +
"triangle has to be constructed");
int numrow = sc.nextInt();
for (int i = 1; i <= numrow; i++) {
for (int j = 1; j <= (numrow - i); j++) {
System.out.print(" ");
}
for (int k = 1; k < i * 2; k++) {
int temp = Math.min(k, i * 2 - k);
if (temp > 9) {
System.out.print(temp + " ");
} else {
System.out.print(temp + " ");
}
}
System.out.println();
}
}
}

In this example I counted the digits, and for every digit I add an extra space.
The output of the value is formatted with leading zeros (digit-count).
public static void main(final String[] args) {
final Scanner sc = new Scanner(System.in);
System.out.println("Enter the no. of rows for which " +
"triangle has to be constructed");
final int numrow = 100;// sc.nextInt();
final int digits = (int) Math.log10(numrow) + 1;
for (int i = 1; i <= numrow; i++) {
for (int j = 1; j <= numrow - i; j++) {
System.out.print(" ");
for (int l = 0; l < digits; l++) {
System.out.print(" ");
}
}
for (int k = 1; k < i * 2; k++) {
final int value = Math.min(k, i * 2 - k);
System.out.print(String.format("%0" + digits + "d ", value));
}
System.out.println();
}
}

You can use String.format method:
"%2d" - format as a two-digit number.
"%02d" - format as a two-digit number with leading zeros.
Example:
// int n = 5;
int n = 12;
// number of digits
int digits = String.valueOf(n).length();
// format string
String format = "%" + digits + "d";
// output
System.out.println("n=" + n + ", format=" + format);
IntStream.rangeClosed(1, n)
.mapToObj(i -> IntStream.rangeClosed(-n, i)
.map(Math::abs)
.map(j -> j = i - j)
.filter(j -> j != 0)
.mapToObj(j -> j > 0 ?
String.format(format, j) : " " .repeat(digits))
.collect(Collectors.joining(" ")))
.forEach(System.out::println);
Output:
n=5, format=%1d
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
n=12, format=%2d
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 6 5 4 3 2 1
1 2 3 4 5 6 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 10 11 10 9 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 10 11 12 11 10 9 8 7 6 5 4 3 2 1
See also: Print the sum of the row and column in a 2d array after each row

Related

For loop to print a numeric pattern does not print the correct pattern

This is what it should look like
9 8 7 6 5 4 3 2 1 0
8 8 7 6 5 4 3 2 1 0
7 7 7 6 5 4 3 2 1 0
6 6 6 6 5 4 3 2 1 0
5 5 5 5 5 4 3 2 1 0
4 4 4 4 4 4 3 2 1 0
3 3 3 3 3 3 3 2 1 0
2 2 2 2 2 2 2 2 1 0
1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0
Here's my attempt.
public class Main {
public static void main(String[] args) {
int i = 9;
int count = -1;
while (i >= count) {
int j = i;
while (j > count) {
System.out.print(j + " ");
j--;
}
System.out.println();
count++;
}
}
}
Here's my actual output:
9 8 7 6 5 4 3 2 1 0
9 8 7 6 5 4 3 2 1
9 8 7 6 5 4 3 2
9 8 7 6 5 4 3
9 8 7 6 5 4
9 8 7 6 5
9 8 7 6
9 8 7
9 8
9
This obviously does not match the expected output. Can someone point out where the mistake is in the code?
This is a Solution that has the right output, but instead of using while-Loops I used for-Loops
public class Main {
public static void main(String[] args) {
int count1 = 9;
for (int i = count1; i >= 0; i--) {
int count2 = i;
if (count1 > count2) {
int tmp = count1 - count2;
for (int j = tmp; j > 0; j--) {
System.out.print(count2 + " ");
}
}
for (int j = count2; j >= 0; j--) {
System.out.print(j + " ");
}
System.out.println();
}
}
}
You can keep two outer variables, counter and multiplier, for the matrix size and repetitions' count respectively:
public class Main {
public static void main(String[] args) {
int counter = 15;
int multiplier = 1;
for (int i = counter; i >= 0; i--) {
for (int j = 0; j<multiplier; j++) {
System.out.printf("%3d", counter); //using %3d for spacing numbers nicely
}
for (int k = counter-1; k >= 0; k--) {
System.out.printf("%3d", k);
}
++multiplier;
--counter;
System.out.println();
}
}
}
For every horizontal line, where counter decreases, and multiplier increases (9 once on 1st line; 8 twice on the second line, etc.):
it will first print the counter, multiplier times;
it will then fill the rest of the line with counter-multiplier number of descending sequence integers, starting from counter-1;
at the end of outer loop's each iteration, a new line is printed.
Output would be:
9 8 7 6 5 4 3 2 1 0
8 8 7 6 5 4 3 2 1 0
7 7 7 6 5 4 3 2 1 0
6 6 6 6 5 4 3 2 1 0
5 5 5 5 5 4 3 2 1 0
4 4 4 4 4 4 3 2 1 0
3 3 3 3 3 3 3 2 1 0
2 2 2 2 2 2 2 2 1 0
1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0
Since you already have your answer, here are a couple alternatives.
String str = "9 8 7 6 5 6 3 2 1 0";
System.out.println(str);
for (int i = 9; i > 0; i--) {
str = str.replace(i+"",(i-1)+"");
System.out.println(str);
}
Or use the String.repeatmethod.
for (int i = 9; i >= 0; i--) {
System.out.print((i+" ").repeat(9-i));
for(int k = i; k >= 0; k--) {
System.out.print(k + " ");
}
System.out.println();
}
With the help of Java8 stream you can write the code as below:
public static void main(String[] args) {
IntStream.range(0, 10)
.forEach(i -> {
IntStream.range(0, 10).forEach(j -> {
System.out.print((9- (j < i ? i : j)) + " " );
});
System.out.println("");
});
}

Printing a squares triangle. How to mirror numbers?

So I've been working on this lab for a while now for my programming class and so far I think I'm on the right track.
However, I'm not quite sure how to mirror the numbers. So pretty much, my code is only printing the top half of the triangle. Anyway here is the actual assignment that was given to us:
Write a program using a Scanner that asks the user for a number n between 1 and 9 (inclusive). The program prints a triangle with n rows. The first row contains only the square of 1, and it is right-justified. The second row contains the square of 2 followed by the square of 1, and is right justified. Subsequent rows include the squares of 3, 2, and 1, and then 4, 3, 2 and 1, and so forth until n rows are printed.
Assuming the user enters 4, the program prints the following triangle to the console:
1
4 1
9 4 1
16 9 4 1
9 4 1
4 1
1
For full credit, each column should be 3 characters wide and the values should be right justified.
Now here is what I have written for my code so far:
import java.util.Scanner;
public class lab6 {
public static void main(String[] args) {
Scanner kybd = new Scanner(System.in);
System.out.println(
"Enter a number that is between 1 and 9 (inclusive): ");
// this is the value that the user will enter for # of rows
int rows = kybd.nextInt();
for (int i = rows; i > 0; i--) {
for (int j = rows; j > 0; j--)
System.out.print((rows - j + 1) < i ?
" " : String.format("%3d", j * j));
System.out.println();
}
}
}
And this is what that code PRINTS when I enter 4:
Enter a number that is between 1 and 9 (inclusive):
4
1
4 1
9 4 1
16 9 4 1
As you can see, I can only get the TOP half of the triangle to print out. I've been playing around trying to figure out how to mirror it but I can't seem to figure it out. I've looked on this website for help, and all over the Internet but I can't seem to do it.
Answer is:
public static void main(String... args) {
Scanner kybd = new Scanner(System.in);
System.out.println("Enter a number that is between 1 and 9 (inclusive): ");
int rows = kybd.nextInt(); // this is the value that the user will enter for # of rows
for (int i = -rows + 1; i < rows; i++) {
for (int j = -rows; j < 0; j++)
System.out.print(abs(i) > j + rows ? " " : String.format("%3d", j * j));
System.out.println();
}
}
Try think of this as how to find points(carthesians) that are betwean three linear functions(area of triangle that lied betwean):
y = 0 // in loops i is y and j is x
y = x + 4
y = -x -4
And here is example result for 4:
And 9:
In the outer loop or stream you have to iterate from 1-n to n-1 (inclusive) and take absolute values for negative numbers. The rest is the same.
If n=6, then the triangle looks like this:
1
4 1
9 4 1
16 9 4 1
25 16 9 4 1
36 25 16 9 4 1
25 16 9 4 1
16 9 4 1
9 4 1
4 1
1
Try it online!
int n = 6;
IntStream.rangeClosed(1 - n, n - 1)
.map(Math::abs)
.peek(i -> IntStream.iterate(n, j -> j > 0, j -> j - 1)
// prepare an element
.mapToObj(j -> i > n - j ? " " : String.format("%3d", j * j))
// print out an element
.forEach(System.out::print))
// start new line
.forEach(i -> System.out.println());
See also: Output an ASCII diamond shape using loops
Another alternative :
public static void main(String args[]) {
Scanner kybd = new Scanner(System.in);
System.out.println("Enter a number that is between 1 and 9 (inclusive): ");
int rows = kybd.nextInt(); // this is the value that the user will enter for # of rows
int row = rows, increment = -1;
while (row <= rows){
for (int j = rows; j > 0; j--) {
System.out.print(rows - j + 1 < row ? " " : String.format("%3d", j * j));
}
System.out.println();
if(row == 1) {
increment = - increment;
}
row += increment;
}
}
The outer loop from 1-n to n-1 inclusive, and the inner decrementing loop from n to 0. The if condition is the absolute value of i should not be greater than n - j.
Try it online!
int n = 6;
for (int i = 1 - n; i <= n - 1; i++) {
for (int j = n; j > 0; j--)
if (Math.abs(i) > n - j)
System.out.print(" ");
else
System.out.printf("%3d", j * j);
System.out.println();
}
Output:
1
4 1
9 4 1
16 9 4 1
25 16 9 4 1
36 25 16 9 4 1
25 16 9 4 1
16 9 4 1
9 4 1
4 1
1
See also: Invert incrementing triangle pattern

Java Looping Arrays

How do I make this loop properly? it right now So it loops but it does not loop properly. It does this
Here are the numbers:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 [1]
How many positions do you want to shift?: 2
2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 [3]
How many positions do you want to shift?: 4
the [] are where its suppose to ask me for my input instead of me just putting in a input
its suppose to run like this:
re are the numbers:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
How many positions do you want to shift?: 1
2 1 15 14 13 12 11 10 9 8 7 6 5 4 3
How many positions do you want to shift?: 4
System.out.println("Here are the numbers:");
for (i=0; i<numberArray.length; i++) {
System.out.print(numberArray[i] + " ");
}
while (x != input.nextInt()){
System.out.printf("How many positions do you want to shift?: ");
int shiftTimes=input.nextInt();
for( i = 0; i < shiftTimes; ++i)
shift.Shifter(numberArray);
for(j = 0; j < numberArray.length; j++)
System.out.printf(numberArray[j]+" ");
}
}
}
Also How Do I make it exit the program when I enter in a invalid number and how do I get get it to read a negative value and get it to shift left
Edit: heres my shifter code
public static void Shifter(int[] list)
{
int i;
if (list.length < 2) return;
int last = list[list.length - 1];
for(i = list.length - 1; i > 0; i--) {
list[i] = list[i - 1];
}
list[0] = last;
}
This should work for right shift. It should work with inputs larger then array length as well.
for (int i = shiftTimes%numberArray.length; i > 0; i--) {
System.out.print(numberArray[numberArray.length - i] + " ");
}
for (int i = 0; i < numberArray.length - shiftTimes%numberArray.length; i++) {
System.out.print(numberArray[i] + " ");
}
Reversing this logic should produce a left shift approach.
An invalid input would be the length of the array (because the result will be the same) or 0 because that doesn't do anything:
if (shiftTimes == numberArray.length || shiftTimes == 0) {
// present error to user
}
UPDATE: Putting the logic in your function. Also updated the invalid input check.
public static void Shifter(int[] list, int input)
{
for (int i = input%list.length; i > 0; i--) {
System.out.print(list[list.length - i] + " ");
}
for (int i = 0; i < list.length - input%list.length; i++) {
System.out.print(list[i] + " ");
}
}
The function call would be:
Shifter(numberArray, shiftTimes);

How to print a diamond of random numbers?

Can someone help me complete this numeric diamond? I have the right side of the diamond printing out, but I'm having trouble printing out the left side of it. If anybody can help I would really appreciate it.
I made some changes to my code. I now need my code to print one column in the middle of the diamond instead of two.
public class NumericDiamond {
public static void main(String[] args) {
/*
1 1
4 3 4 2
4 4 5 7 4 3
5 3 5 4
4 5
*/
int noOfColumns = 1;
int noOfSpaces = 3;
int start = 0;
for (int i = 1; i <= 5; i++) {
for (int j = noOfSpaces; j >= 1; j--) {
System.out.print(" ");
}
for (int j = 1; j <= noOfColumns; j++) {
System.out.print(noOfColumns);
}
if (i < 5) {
start = i;
} else {
start = 8 - i;
}
System.out.print(start + " ");
start--;
System.out.println();
if (i < 3) {
noOfColumns = noOfColumns + 2;
noOfSpaces = noOfSpaces - 1;
} else {
noOfColumns = noOfColumns - 2;
noOfSpaces = noOfSpaces + 1;
}
}
}
}
When you write something out to the screen, think in rows.
In the first and last row, you print 1 random number. In the second and fourth row, you print 3 random numbers. In the middle row, you print 5 random numbers.
You can use tab or spaces to place the numbers to their positions.
Random rnd = new Random();
for(int i = 0; i < 5; i++) {
if(0 == i || 4 == i) System.out.println("\t\t" + (rnd.nextInt(5)+1) + "\t\t\t" + (i+1));
if(1 == i || 3 == i) System.out.println("\t" + (rnd.nextInt(5)+1) + "\t" + (rnd.nextInt(5)+1) + "\t" + (rnd.nextInt(5)+1) + "\t\t" + (i+1));
if(2 == i) System.out.println((rnd.nextInt(5)+1) + "\t" + (rnd.nextInt(5)+1) + "\t" + (rnd.nextInt(5)+1) + "\t" + (rnd.nextInt(5)+1) + "\t" + (rnd.nextInt(5)+1) + "\t" + (i+1));
}
Something like this.
To print a diamond you can use two nested for loops (or streams) over rows and columns from -n to n. The diamond shape is obtained when n > iAbs + jAbs. The value of a cell depends on its coordinates i and j, or it can be some kind of constant or random value:
int n = 5;
for (int i = -n; i <= n; i++) {
// absolute value of 'i'
int iAbs = Math.abs(i);
for (int j = -n; j <= n; j++) {
// absolute value of 'j'
int jAbs = Math.abs(j);
// diamond shape (cell value = iAbs + jAbs)
if (iAbs + jAbs > n) {
System.out.print(" ");
} else {
System.out.print(" " + (iAbs + jAbs));
}
}
System.out.println(" i=" + iAbs);
}
Output:
5 i=5
5 4 5 i=4
5 4 3 4 5 i=3
5 4 3 2 3 4 5 i=2
5 4 3 2 1 2 3 4 5 i=1
5 4 3 2 1 0 1 2 3 4 5 i=0
5 4 3 2 1 2 3 4 5 i=1
5 4 3 2 3 4 5 i=2
5 4 3 4 5 i=3
5 4 5 i=4
5 i=5
Similarly, you can use two nested streams:
int n = 5;
IntStream.rangeClosed(-n, n)
// absolute value of 'i'
.map(Math::abs)
.peek(i -> IntStream.rangeClosed(-n, n)
// absolute value of 'j'
.map(Math::abs)
// diamond shape (cell value = n - i - j)
.mapToObj(j -> i + j > n ? " " : " " + (n - i - j))
.forEach(System.out::print))
.mapToObj(i -> " i=" + i)
.forEach(System.out::println);
Output:
0 i=5
0 1 0 i=4
0 1 2 1 0 i=3
0 1 2 3 2 1 0 i=2
0 1 2 3 4 3 2 1 0 i=1
0 1 2 3 4 5 4 3 2 1 0 i=0
0 1 2 3 4 3 2 1 0 i=1
0 1 2 3 2 1 0 i=2
0 1 2 1 0 i=3
0 1 0 i=4
0 i=5
See also:
• Drawing numeric diamond
• Diamond with nested for loops

Get the matrix of Levensthein Distance

I write some code of java that implemented Levensthein distance to calculate the similarity from two string. My code is like this :
public class LevenshteinDistance {
public LevenshteinDistance() {
}
public double similarity(String s1, String s2) {
if (s1.length() < s2.length()) { // s1 should always be bigger
String swap = s1;
s1 = s2;
s2 = swap;
}
int bigLen = s1.length();
if (bigLen == 0) {
return 1.0; /* both strings are zero length */ }
return (bigLen - computeEditDistance(s1, s2)) / (double) bigLen;
}
public int computeEditDistance(String s1, String s2) {
s1 = s1.toLowerCase();
s2 = s2.toLowerCase();
int[] costs = new int[s2.length() + 1];
for (int i = 0; i <= s1.length(); i++) {
int lastValue = i;
for (int j = 0; j <= s2.length(); j++) {
if (i == 0) {
costs[j] = j;
} else {
if (j > 0) {
int newValue = costs[j - 1];
if (s1.charAt(i - 1) != s2.charAt(j - 1)) {
newValue = Math.min(Math.min(newValue, lastValue), costs[j]) + 1;
}
costs[j - 1] = lastValue;
lastValue = newValue;
}
}
}
if (i > 0) {
costs[s2.length()] = lastValue;
}
}
return costs[s2.length()];
}
public double printDistance(String s1, String s2) {
System.out.println("[Edit Distance] : " + s1 + " and " + s2 + " have similarity is = " + similarity(s1, s2) * 100 + " %");
return similarity(s1, s2) * 100;
}
public static void main(String[] args) {
LevenshteinDistance lv = new LevenshteinDistance();
lv.printDistance("164164617044", "164164617044");
}
}
From my code above, I have an output like this :
[Edit Distance] : 164164617044 and 164164617044 have similarity is = 100.0 %
How to get the output the matriks that represented Levensthein distance like
1 6 4 1 6 4 6 1 7 0 4 4
0 1 2 3 4 5 6 7 8 9 10 11 12
1 1 0 1 2 3 4 5 6 7 8 9 10 11
6 2 1 0 1 2 3 4 5 6 7 8 9 10
4 3 2 1 0 1 2 3 4 5 6 7 8 9
1 4 3 2 1 0 1 2 3 4 5 6 7 8
6 5 4 3 2 1 0 1 2 3 4 5 6 7
4 6 5 4 3 2 1 0 1 2 3 4 5 6
6 7 6 5 4 3 2 1 0 1 2 3 4 5
1 8 7 6 5 4 3 2 1 0 1 2 3 4
7 9 8 7 6 5 4 3 2 1 0 1 2 3
0 10 9 8 7 6 5 4 3 2 1 0 1 2
4 11 10 9 8 7 6 5 4 3 2 1 0 1
4 12 11 10 9 8 7 6 5 4 3 2 1 0
for the help, thanks
The thing is that your implementation only calculates the distance and not the resulting matrix.
This solution is based on the Wagner–Fischer algorithm:
public class LevenshteinDistance {
public static void main(String[] args) {
String str1 = "164164617044", str2 = "164164617044";
System.out.print("String 1: \"" + str1 + "\" String 2: \"" + str2
+ "\".\n\n");
int[][] resultingMatrix = resultingMatrix(str1, str2);
int distance = resultingMatrix[str1.length()][str2.length()];
double similarity = similarity(str1, str2, distance), similarityPercentage = similarity * 100.0;
System.out.print("Levenshtein distance = " + distance + ".\n\n");
System.out.print("Similarity = " + similarity + ".\n\n");
System.out.print("Similarity Percentage = " + similarityPercentage
+ "%.\n\n");
System.out.print("Resulting Matrix:\n");
for (int charsInStr2 = 0; charsInStr2 < str2.length(); charsInStr2++) {
if (charsInStr2 == 0) {
System.out.print(String.format("%-5s%-5s%-5s", " ", " ", "'" + str2.charAt(charsInStr2) + "'"));
} else {
System.out
.print(String.format("%-5s", "'" + str2.charAt(charsInStr2)+ "'"));
}
}
System.out.print("\n");
for (int i = 0; i < resultingMatrix.length; i++) {
String line = "";
for (int j = 0; j < resultingMatrix[i].length; j++) {
line += String.format("%-5s", resultingMatrix[i][j]);
}
if(i == 0)
System.out.printf("%-4s %s\n", " ", line);
else{
System.out.printf("%-4s %s\n", "'" + str1.charAt(i-1) + "'", line);
}
}
}
public static int[][] resultingMatrix(String str1, String str2) {
int[][] dist = new int[str1.length() + 1][str2.length() + 1];
for (int i = 0; i <= str1.length(); i++) {
dist[i][0] = i;
}
for (int j = 1; j <= str2.length(); j++) {
dist[0][j] = j;
}
for (int i = 1; i <= str1.length(); i++)
for (int j = 1; j <= str2.length(); j++)
dist[i][j] = Math
.min(Math.min(dist[i - 1][j] + 1, dist[i][j - 1] + 1),
dist[i - 1][j - 1]
+ ((str1.charAt(i - 1) == str2
.charAt(j - 1)) ? 0 : 1));
return dist;
}
public static double similarity(String str1, String str2, int distance) {
double bigLenght = Math.max(str1.length(), str2.length());
return (bigLenght - distance) / bigLenght;
}
}
Example:
String 1: "164164617044" String 2: "164164617044".
Levenshtein distance = 0.
Similarity = 1.0.
Similarity Percentage = 100.0%.
Resulting Matrix:
'1' '6' '4' '1' '6' '4' '6' '1' '7' '0' '4' '4'
0 1 2 3 4 5 6 7 8 9 10 11 12
'1' 1 0 1 2 3 4 5 6 7 8 9 10 11
'6' 2 1 0 1 2 3 4 5 6 7 8 9 10
'4' 3 2 1 0 1 2 3 4 5 6 7 8 9
'1' 4 3 2 1 0 1 2 3 4 5 6 7 8
'6' 5 4 3 2 1 0 1 2 3 4 5 6 7
'4' 6 5 4 3 2 1 0 1 2 3 4 5 6
'6' 7 6 5 4 3 2 1 0 1 2 3 4 5
'1' 8 7 6 5 4 3 2 1 0 1 2 3 4
'7' 9 8 7 6 5 4 3 2 1 0 1 2 3
'0' 10 9 8 7 6 5 4 3 2 1 0 1 2
'4' 11 10 9 8 7 6 5 4 3 2 1 0 1
'4' 12 11 10 9 8 7 6 5 4 3 2 1 0
Note that the Levensthein distance is always the element in the right bottom corner of the resulting matrix (resultingMatrix[str1Len][str2Len]). Also, take a look at the method for calculating the similarity in my solution.

Categories

Resources