Skip to content

Commit 9c21417

Browse files
refactor 384
1 parent 03bb323 commit 9c21417

File tree

1 file changed

+6
-9
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+6
-9
lines changed

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.fishercoder.solutions;
2-
/**384. Shuffle an Array
2+
/**
3+
* 384. Shuffle an Array
34
Shuffle a set of numbers without duplicates.
45
56
Example:
@@ -8,7 +9,8 @@
89
int[] nums = {1,2,3};
910
Solution solution = new Solution(nums);
1011
11-
// Shuffle the array [1,2,3] and return its result. Any permutation of [1,2,3] must equally likely to be returned.
12+
// Shuffle the array [1,2,3] and return its result.
13+
Any permutation of [1,2,3] must equally likely to be returned.
1214
solution.shuffle();
1315
1416
// Resets the array back to its original configuration [1,2,3].
@@ -24,19 +26,14 @@
2426

2527
public class _384 {
2628

27-
public static void main(String... strings) {
28-
int[] nums = new int[]{1, 2, 3};
29-
Solution test = new Solution(nums);
30-
}
31-
32-
public static class Solution {
29+
public static class Solution1 {
3330
//Note: the problem states that this is a set without duplicates which makes building all combinations easier
3431

3532
private List<List<Integer>> combinations;
3633
private int[] original;
3734
private Random random;
3835

39-
public Solution(int[] nums) {
36+
public Solution1(int[] nums) {
4037
original = nums;
4138
random = new Random();
4239
combinations = buildAllComb(nums);

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