NoRepeatsPlease

Developer
Size
1,668 Kb
Views
42,504

How do I make an norepeatsplease?

What is a norepeatsplease? How do you make a norepeatsplease? This script and codes were developed by Ben on 12 August 2022, Friday.

NoRepeatsPlease Previews

NoRepeatsPlease - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>NoRepeatsPlease</title>
</head>
<body> <script src="js/index.js"></script>
</body>
</html>

NoRepeatsPlease - Script Codes JS Codes

function permAlone(str) { debugger var arr = str.split(''), permutations = []; function swap(a, b) { var tmp = arr[a]; arr[a] = arr[b]; arr[b] = tmp; } function generate(n) { if (n == 1) { permutations.push(arr.join('')); } else { for (var i = 0; i != n; ++i) { generate(n - 1); swap(n % 2 ? 0 : i, n - 1); } } } generate(arr.length); //permutations.map(arr => arr.join('')) permutations=permutations.filter(stri => !(stri.match(/([a-zA-Z])\1+/))) return permutations.length;
}
console.log(permAlone('aab'));
console.log(permAlone("aab")) //should return a number.
console.log(permAlone("aab")) //should return 2.
console.log(permAlone("aaa")) //should return 0.
console.log(permAlone("aabb")) //should return 8.
console.log(permAlone("abcdefa")) //should return 3600.
console.log(permAlone("abfdefa")) //should return 2640.
console.log(permAlone("zzzzzzzz")) //should return 0.
permAlone("a") //should return 1.
permAlone("aaab") //should return 0.
permAlone("aaabb") //should return 12.
NoRepeatsPlease - Script Codes
NoRepeatsPlease - Script Codes
Home Page Home
Developer Ben
Username bencarp
Uploaded August 12, 2022
Rating 3
Size 1,668 Kb
Views 42,504
Do you need developer help for NoRepeatsPlease?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Ben (bencarp) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!