Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version
This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.
function PalindromeCreator(str) { | |
const isStringPalindrome = isPalindrome(str); | |
if (isStringPalindrome) return 'palindrome'; | |
const palindrome = findPalindrome([{ | |
str, | |
chars: [], | |
}], 2, 0); | |
return palindrome && palindrome.str.length > 2 ? getRemovedCharsForPalindrome(palindrome) : 'not possible'; | |
} |
function WordSplit(strArr) { | |
const word = strArr[0]; | |
const substrings = generateSubstrings(word); | |
const words = substrings.filter(substring => strArr[1].includes(substring)); | |
const pairs = generatePairs(words); | |
const pair = pairs.find(pair => pair.join('') === word); | |
return pair ? pair.join(',') : 'no pair'; | |
} | |
function generateSubstrings(str) { |
Keywords: Java, JDK (Java Development Kit), MacOS, Homebrew, Specific Version
This how-to guide covers how to install different versions of the JDK on MacOS with Homebrew.
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>CrystalCollectors</title> | |
<style> | |
.crystal-image { | |
cursor: pointer; | |
height: 100px; | |
margin: 10px; | |
width: 100px; |
class NeuralNetwork: | |
def __init__(self, x, y): | |
self.input = x | |
self.weights1 = np.random.rand(self.input.shape[1],4) | |
self.weights2 = np.random.rand(4,1) | |
self.y = y | |
self.output = np.zeros(self.y.shape) | |
def feedforward(self): | |
self.layer1 = sigmoid(np.dot(self.input, self.weights1)) |
num1 = int(raw_input("Please input first number: ")) | |
num2 = int(raw_input("Please input second number: ")) | |
def multiply(): | |
print "{} multiplied by {} is {}".format(num1, num2, num1 * num2) | |
def divide(): | |
print "{} divided by {} is {}".format(num1, num2, num1 / num2) | |
operator = raw_input("Would you like to multiply these numbers, or divide them? : ") |
// You are a botanist growing gardens of flowers for a picky customer. Your customer wants only red flowers but the seeds for your red flowers and your blue flowers have become mixed up. You are going to use all of your available gardens to grow flowers and then sell all of your red flowers to your customer. | |
// A few important points | |
// - Your soil quality is poor and successfully grown flowers will crowd out other seeds from growing easily. Thus the first seed you plant has a 75% chance of growing a flower but every subsequently planted seed only has a 25% chance of growing into a plant. Once a seed has failed to grow in a particular garden, you are going to abandon planting any additional seeds in it as it is an indication that the soil quailty is not conducive to growing any additional plants. | |
// - Red flowers are particularly competitive to neighboring plants. After a red flower grows in a garden, the garden will no longer be able to grow any additional plants and thus you will wholly abandon plan |
#--SETTINGS-IMPORTER------------------------ | |
class SettingsImporter(): | |
LANGUAGES = [ | |
('ar', 'Arabic'), | |
('de', 'German'), | |
('el', 'Greek'), | |
('en', 'English'), | |
('es', 'Spanish'), | |
('fr', 'French'), |
// TODO: finish | |
function calc(input) { | |
const characters = input.split(''); // ['(', '1', '+', '2', ')'] | |
let depth = 0; | |
const operations = []; // ['1', '+', '2'] | |
let calculation = []; | |
for (let characterIndex = 0; characterIndex < characters.length; characterIndex++) { | |
const character = characters[characterIndex]; | |
if (character === '(') { |