Skip to content

Commit 03bb323

Browse files
refactor 382
1 parent 24df592 commit 03bb323

File tree

1 file changed

+3
-2
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.Random;
88

99
/**382. Linked List Random Node
10+
*
1011
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.
1112
1213
Follow up:
@@ -25,14 +26,14 @@
2526
*/
2627
public class _382 {
2728

28-
class Solution {
29+
public static class Solution1 {
2930
private Map<Integer, ListNode> map;
3031
private Random rand;
3132

3233
/**
3334
* @param head The linked list's head. Note that the head is guanranteed to be not null, so it contains at least one node.
3435
*/
35-
public Solution(ListNode head) {
36+
public Solution1(ListNode head) {
3637
map = new HashMap();
3738
rand = new Random();
3839
int i = 0;

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