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

Commit 0d276fd

Browse files
add skeleton for 1134
1 parent e12a331 commit 0d276fd

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Your ideas/fixes/algorithms are more than welcome!
3939
|1160|[Find Words That Can Be Formed by Characters](https://leetcode.com/problems/find-words-that-can-be-formed-by-characters/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1160.java) | O(n) | O(m) | |Easy||
4040
|1154|[Day of the Year](https://leetcode.com/problems/day-of-the-year/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1154.java) | O(1) | O(1) | |Easy||
4141
|1137|[N-th Tribonacci Number](https://leetcode.com/problems/n-th-tribonacci-number/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1137.java) | O(n) | O(n) | |Easy||
42+
|1134|[Armstrong Number](https://leetcode.com/problems/armstrong-number/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1134.java) | | | |Easy||
4243
|1122|[Relative Sort Array](https://leetcode.com/problems/relative-sort-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1122.java) | O(n) | O(n) | |Easy||
4344
|1170|[Compare Strings by Frequency of the Smallest Character](https://leetcode.com/problems/compare-strings-by-frequency-of-the-smallest-character/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1170.java) | | | |Easy||
4445
|1119|[Remove Vowels from a String](https://leetcode.com/problems/remove-vowels-from-a-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1119.java) | | | [:tv:](https://www.youtube.com/watch?v=6KCBrIWEauw)|Easy||
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.fishercoder.solutions;
2+
3+
/**
4+
* 1134. Armstrong Number
5+
*
6+
* The k-digit number N is an Armstrong number if and only if the k-th power of each digit sums to N.
7+
* Given a positive integer N, return true if and only if it is an Armstrong number.
8+
*
9+
* Example 1:
10+
* Input: 153
11+
* Output: true
12+
* Explanation:
13+
* 153 is a 3-digit number, and 153 = 1^3 + 5^3 + 3^3.
14+
*
15+
* Example 2:
16+
* Input: 123
17+
* Output: false
18+
* Explanation:
19+
* 123 is a 3-digit number, and 123 != 1^3 + 2^3 + 3^3 = 36.
20+
*
21+
* Note:
22+
* 1 <= N <= 10^8
23+
* */
24+
public class _1134 {
25+
public static class Solution1 {
26+
public boolean isArmstrong(int N) {
27+
return false;
28+
}
29+
}
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.fishercoder;
2+
3+
import com.fishercoder.solutions._1134;
4+
import org.junit.BeforeClass;
5+
import org.junit.Test;
6+
7+
import static org.junit.Assert.assertEquals;
8+
9+
public class _1134Test {
10+
private static _1134.Solution1 solution1;
11+
12+
@BeforeClass
13+
public static void setup() {
14+
solution1 = new _1134.Solution1();
15+
}
16+
17+
@Test
18+
public void test1() {
19+
assertEquals(true, solution1.isArmstrong(153));
20+
}
21+
22+
@Test
23+
public void test2() {
24+
assertEquals(false, solution1.isArmstrong(123));
25+
}
26+
}

0 commit comments

Comments
 (0)