We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1bbe09c commit 95ef264Copy full SHA for 95ef264
src/main/java/com/fishercoder/solutions/_1134.java
@@ -24,7 +24,20 @@
24
public class _1134 {
25
public static class Solution1 {
26
public boolean isArmstrong(int N) {
27
- return false;
+ int numOfDigits = 0;
28
+ int copyN = N;
29
+ while (copyN > 0) {
30
+ copyN /= 10;
31
+ numOfDigits++;
32
+ }
33
+ int sum = 0;
34
+ copyN = N;
35
+ while (N > 0) {
36
+ int digit = N % 10;
37
+ sum += Math.pow(digit, numOfDigits);
38
+ N /= 10;
39
40
+ return sum == copyN;
41
}
42
43
0 commit comments