Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b12a25d

Browse files
committed
Check n == null
1 parent 86d5281 commit b12a25d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/com/hackerrank/algorithms/recursion/RecursiveDigitSum.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class RecursiveDigitSum {
2222
* @return recursive sum of the digits
2323
*/
2424
private static int superDigit(String n, int k) {
25+
if(n == null) throw new Exception("by input exception [" + n + "]");
2526
if (n.length() == 1 && k == 0) {
2627
return Integer.parseInt(n);
2728
}

0 commit comments

Comments
 (0)