You are viewing a single comment's thread. Return to all comments →
Test cases are getting "Wrong Answer" but the output is actually the same.
This is my code in Java:
import java.io.*; import java.util.*; public class Solution { public static boolean isPrime(int num){ if (num == 1) return false; for (int i = 2; i <= Math.sqrt(num); i++){ if (num % i == 0) return false; } return true; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-- > 0){ int num = sc.nextInt(); if (isPrime(num)) System.out.println("Prime"); else System.out.println("Not Prime"); } sc.close(); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 25: Running Time and Complexity
You are viewing a single comment's thread. Return to all comments →
HELP
Test cases are getting "Wrong Answer" but the output is actually the same.
This is my code in Java: