We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The problem is in main method. Its not because of your code. My code is different but these cases don't run. I tried my code on command line. It shows following exception.
java CTCI_RANSOM_NOTE_Solution input13.txt
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Integer.parseInt(Integer.java:662)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at CTCI_RANSOM_NOTE_Solution.main(CTCI_RANSOM_NOTE_Solution.java:34)
LIne 34: int m = Integer.parseInt(mn[0]);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Hash Tables: Ransom Note
You are viewing a single comment's thread. Return to all comments →
The problem is in main method. Its not because of your code. My code is different but these cases don't run. I tried my code on command line. It shows following exception.
java CTCI_RANSOM_NOTE_Solution input13.txt
Exception in thread "main" java.lang.NumberFormatException: For input string: "" at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.base/java.lang.Integer.parseInt(Integer.java:662) at java.base/java.lang.Integer.parseInt(Integer.java:770) at CTCI_RANSOM_NOTE_Solution.main(CTCI_RANSOM_NOTE_Solution.java:34)
LIne 34: int m = Integer.parseInt(mn[0]);