wrong
rlniranjan9 opened this issue · 5 comments
rlniranjan9 commented
Compiler Message
Wrong Answer
Input (stdin)Download
INPUT
Expected OutputDownload
Stuart
Kristeen
Christene
Amina
Aamina
RodneyShag commented
Which question/problem are you referring to?
rlniranjan9 commented
all
…On Thu, Mar 28, 2019 at 5:14 AM Rodney Shaghoulian ***@***.***> wrote:
Which question/problem are you referring to?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AtcqqNu1LSF5VUwE8owkAOrdWnoq5_qkks5vbAJ4gaJpZM4cNgo2>
.
RodneyShag commented
Please make sure you are using Java 8 when submitting solutions. Also, HackerRank has changed many of the 300 problems I've solved, so sometimes you may have to change my solution slightly to get it to work with HackerRank's updated problem. Or, open an issue with a specific solution that doesn't work and I will fix it. Thanks.
rlniranjan9 commented
Hi rodney,
where should i paste the code. the following code cannot be changed , i
need to insert the code in between, please help how and what to paste
import java.util.*;
import java.security.*;
public class Solution {
public static void main(String[] args) {
DoNotTerminate.forbidExit();
try {
Scanner in = new Scanner(System.in);
int n = in .nextInt();
in.close();
//String s=???; Complete this line below
if (n == Integer.parseInt(s)) {
System.out.println("Good job");
} else {
System.out.println("Wrong answer.");
}
} catch (DoNotTerminate.ExitTrappedException e) {
System.out.println("Unsuccessful Termination!!");
}
}
}
//The following class will prevent you from terminating the code using
exit(0)!
class DoNotTerminate {
public static class ExitTrappedException extends SecurityException {
private static final long serialVersionUID = 1;
}
public static void forbidExit() {
final SecurityManager securityManager = new SecurityManager() {
@OverRide
public void checkPermission(Permission permission) {
if (permission.getName().contains("exitVM")) {
throw new ExitTrappedException();
}
}
};
System.setSecurityManager(securityManager);
}
}
Regards,
lokesh
…On Thu, Mar 28, 2019 at 10:47 AM Rodney Shaghoulian < ***@***.***> wrote:
Closed #14 <#14>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AtcqqHn3QAjqoQBYxj6krlsLk7dpYluiks5vbEidgaJpZM4cNgo2>
.
RodneyShag commented
Hi. I'm guessing you're referring to the "Java Int to String" problem. I've updated the solution to just the part you need to copy/paste, which is: String s = "" + n;