CopyPastor

Detecting plagiarism made easy.

Score: 0.8077080249786377; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-10-15
by Aravinda Weerasekara

Original Post

Original - Posted on 2019-09-03
by Lukasz Kardasz



            
Present in both answers; Present only in the new answer; Present only in the old answer;

I used this java code as a solution. Got 100%
class Solution { public int solution(int[] A) { int result = 0; Set<Integer> set = new HashSet<>(); for (int x : A) { set.add(x); } for (int x = 1; x < set.size() + 2; x++) { if (!set.contains(x)) { result = x; } } return result; } }
public static int solution(int[] A) { Arrays.sort(A); int minNumber = 1; int length = A.length - 1; int max = A[length]; Set < Integer > set = new HashSet < > (); for (int i: A) { if (i > 0) { set.add(i); } } for (int j = 1; j <= max + 1; j++) { if (!set.contains(j)) { minNumber = j; break; } } return minNumber; }


        
Present in both answers; Present only in the new answer; Present only in the old answer;