From 3b52109fc0d0ec43cbd21eecba0892353edac37a Mon Sep 17 00:00:00 2001 From: joshiujjawal22 Date: Fri, 29 May 2020 12:32:24 +0530 Subject: [PATCH] Added test cases --- Others/3 sum.java | 14 ++++++++++++- ...on of array without using extra space.java | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Others/3 sum.java b/Others/3 sum.java index 3c008ff7..577044aa 100644 --- a/Others/3 sum.java +++ b/Others/3 sum.java @@ -11,6 +11,18 @@ import java.util.Arrays; * * @author Ujjawal Joshi * @date 2020.05.18 + * + * Test Cases: + Input: + * 6 //Length of array + 12 3 4 1 6 9 + target=24 + * Output:3 9 12 + * Explanation: There is a triplet (12, 3 and 9) present + in the array whose sum is 24. + * + * + */ @@ -26,7 +38,7 @@ class threesum{ { a[i]=sc.nextInt(); } - System.out.println("Number to be find"); + System.out.println("Target"); int n_find=sc.nextInt(); Arrays.sort(a); // Sort the array if array is not sorted diff --git a/Others/Rotation of array without using extra space.java b/Others/Rotation of array without using extra space.java index c25dbaef..76380be3 100644 --- a/Others/Rotation of array without using extra space.java +++ b/Others/Rotation of array without using extra space.java @@ -8,6 +8,27 @@ import java.util.*; * * @author Ujjawal Joshi * @date 2020.05.18 + * + * Test Cases: + + Input: + 2 //Size of matrix + 1 2 + 3 4 + Output: + 3 1 + 4 2 + ------------------------------ + Input: + 3 //Size of matrix + 1 2 3 + 4 5 6 + 7 8 9 + Output: + 7 4 1 + 8 5 2 + 9 6 3 + * */ class main{