Skip to content

Instantly share code, notes, and snippets.

Sonya Chhabra sonyakc

Block or report user

Report or block sonyakc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sonyakc
sonyakc / Permutation.java
Created Dec 30, 2018
Output all permutations of a given string
View Permutation.java
import java.util.LinkedHashSet;
import java.util.Set;
public class Permutation {
public static void main(String[] args) {
String str = "sonya"; // 5 * 4 * 3 * 2 = 20 * 6 = 120
Permutation permutation = new Permutation();
StringBuilder builder = new StringBuilder();
Set<String> permSet = new LinkedHashSet<>();
permutation.permute(str, builder, permSet);
You can’t perform that action at this time.