Skip to content

Commit c506fd9

Browse files
refactor 382
1 parent 74a8534 commit c506fd9

File tree

1 file changed

+0
-18
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-18
lines changed

src/main/java/com/fishercoder/solutions/_382.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,6 @@
66
import java.util.Map;
77
import java.util.Random;
88

9-
/**382. Linked List Random Node
10-
*
11-
Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.
12-
13-
Follow up:
14-
What if the linked list is extremely large and its length is unknown to you? Could you solve this efficiently without using extra space?
15-
16-
Example:
17-
18-
// Init a singly linked list [1,2,3].
19-
ListNode head = new ListNode(1);
20-
head.next = new ListNode(2);
21-
head.next.next = new ListNode(3);
22-
Solution solution = new Solution(head);
23-
24-
// getRandom() should return either 1, 2, or 3 randomly. Each element should have equal probability of returning.
25-
solution.getRandom();
26-
*/
279
public class _382 {
2810

2911
public static class Solution1 {

0 commit comments

Comments
 (0)