Skip to content

Commit 017b6e4

Browse files
add skeleton for 1175
1 parent a75dee8 commit 017b6e4

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ _If you like this project, please leave me a star._ ★
5151
|1185|[Day of the Week](https://leetcode.com/problems/day-of-the-week/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1185.java) | |Easy||
5252
|1184|[Distance Between Bus Stops](https://leetcode.com/problems/distance-between-bus-stops/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1184.java) | [:tv:](https://www.youtube.com/watch?v=RFq7yA5iyhI)|Easy||
5353
|1180|[Count Substrings with Only One Distinct Letter](https://leetcode.com/problems/count-substrings-with-only-one-distinct-letter/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1180.java) | |Easy|Math, String|
54+
|1175|[Prime Arrangements](https://leetcode.com/problems/prime-arrangements/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1175.java) | |Easy||
5455
|1165|[Single-Row Keyboard](https://leetcode.com/problems/single-row-keyboard/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1165.java) | |Easy||
5556
|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)| |Easy||
5657
|1154|[Day of the Year](https://leetcode.com/problems/day-of-the-year/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1154.java) | |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+
* 1175. Prime Arrangements
5+
*
6+
* Return the number of permutations of 1 to n so that prime numbers are at prime indices (1-indexed.)
7+
* (Recall that an integer is prime if and only if it is greater than 1,
8+
* and cannot be written as a product of two positive integers both smaller than it.)
9+
* Since the answer may be large, return the answer modulo 10^9 + 7.
10+
*
11+
* Example 1:
12+
* Input: n = 5
13+
* Output: 12
14+
* Explanation: For example [1,2,5,4,3] is a valid permutation, but [5,2,3,4,1] is not because the prime number 5 is at index 1.
15+
*
16+
* Example 2:
17+
* Input: n = 100
18+
* Output: 682289015
19+
*
20+
* Constraints:
21+
* 1 <= n <= 100
22+
* */
23+
public class _1175 {
24+
public static class Solution1 {
25+
public int numPrimeArrangements(int n) {
26+
//TODO: implement it
27+
return -1;
28+
}
29+
}
30+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.fishercoder;
2+
3+
import com.fishercoder.solutions._1175;
4+
import org.junit.BeforeClass;
5+
import org.junit.Ignore;
6+
import org.junit.Test;
7+
8+
import static org.junit.Assert.assertEquals;
9+
10+
@Ignore
11+
public class _1175Test {
12+
private static _1175.Solution1 solution1;
13+
14+
@BeforeClass
15+
public static void setup() {
16+
solution1 = new _1175.Solution1();
17+
}
18+
19+
@Test
20+
public void test1() {
21+
assertEquals(12, solution1.numPrimeArrangements(5));
22+
}
23+
24+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy