BlogHide Resteemsdrago18121996 (68)in ita • 3 days agoAffinefunction encode(string $text, int $num1, int $num2): string{ $res = ""; $alphabet = range('a', 'z'); $lowerString = strtolower($text); $counter = 0; if(!isGcd($num1, 26)){throw new Exception();}drago18121996 (68)in ita • 5 days agoSumdeclare(strict_types=1); function sumOfMultiples(int $number, array $multiples): int{ $res = 1; $setres = []; foreach($multiples as $mult){ if($mult < 1 || $mult > $number) continue; $i…drago18121996 (68)in ita • 18 days agoETLexport function transform(old: {[key: string]: string[]}) { let expected: {[key: string]: number} = {}; for(const [keys, values] of Object.entries(old)){ for(const elm of values){…drago18121996 (68)in ita • 19 days agoDiamontimport java.util.*; class DiamondPrinter { String repeatAllSegm(int count){drago18121996 (68)in ita • last monthLindergarten// // This is only a SKELETON file for the 'Kindergarten Garden' exercise. // It's been provided as a convenience to get you started writing code faster. // const DEFAULT_STUDENTS: Student[] =…drago18121996 (68)in ita • last monthGarden// // This is only a SKELETON file for the 'Kindergarten Garden' exercise. // It's been provided as a convenience to get you started writing code faster. // const DEFAULT_STUDENTS = […drago18121996 (68)in ita • last monthAngramexport class Anagram { input : string; constructor(input: string) { this.input = input.toLowerCase(); } public matches(...potentials: string[]): string[] { let res: string[] = []; let…drago18121996 (68)in ita • last monthComplex informationexport class ComplexNumber { r : number; i : number; constructor(real: number, imaginary: number) { this.r = real; this.i = imaginary; } public get real(): number { return this.r; }…drago18121996 (68)in ita • 2 months agoBobusing System; using System.Text.RegularExpressions; public static class Bob { public static string Response(string statement) { string statementmod= statement.Trim(); bool isQuestion =…drago18121996 (68)in ita • 2 months agoPHPdeclare(strict_types=1); function steps(int $number): int{ if($number 1){ if($number % 2 ==0){ $number /= 2; } else{ $number = 3*$number+1; } $counter +=1; } return $counter; }drago18121996 (68)in ita • 2 months agoAccumulatedeclare(strict_types=1); function accumulate(array $input, callable $accumulator): array{ $result = []; for($i=0; $idrago18121996 (68)in ita • 2 months agoHandshakeexport const commands = (numb) => { let result = []; if(numb & 1) result.push('wink'); if(numb & 2) result.push('double blink'); if(numb & 4) result.push('close your eyes'); if(numb & 8)…drago18121996 (68)in ita • 2 months agoGrainsexport const square = (num) => { if(num 64) throw new Error('square must be between 1 and 64'); return 2n**BigInt(num-1); }; export const total = () => { let result = 0n; for(let i=0; idrago18121996 (68)in ita • 2 months agoComplex Numbers// // This is only a SKELETON file for the 'Complex Numbers' exercise. It's been provided as a // convenience to get you started writing code faster. // export class ComplexNumber {…drago18121996 (68)in ita • 2 months agoBobexport const hey = (message) => { let new_mess = message.replace(/[^a-zA-Z]/g, '').trim(); let message_trim = message.trim(); if(!message_trim) {return "Fine. Be that way!"}…drago18121996 (68)in ita • 2 months agoSchoolclass School: def init (self): self.student ={} self.history = [] def student_exists(self, name):drago18121996 (68)in ita • 2 months agoSolutionexport const colorCode = (color) => COLORS.indexOf(color); export const COLORS = ["black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"];drago18121996 (68)in ita • 2 months agoStrings!import string letters = string.ascii_lowercase consonant = ''.join([letter for letter in letters if letter in 'aeiou']) text = "many hands make light work." find = ''.join([letter for letter in…drago18121996 (68)in ita • 2 months agoString inverseusing System; public static class ReverseString { public static string Reverse(string input) { char [] cArray = input.ToCharArray(); string reverse = String.Empty; for (int i = input.Length…drago18121996 (68)in ita • 3 months agoLedgerusing System; using System.Collections.Generic; using System.Globalization; using System.Linq; public class LedgerEntry{ public LedgerEntry(DateTime date, string desc, decimal chg){ Date =…