BlogHide Resteemsdrago18121996 (68)in ita • 14 days agoArmstrongdeclare(strict_types=1); function isArmstrongNumber(int $number): bool { $res = 0; $str_cr = (string)$number; $len = strlen((string)$number); for($i=0; $idrago18121996 (68)in ita • 28 days agoMatrixusing System; using System.Collections.Generic; public class Matrix{ public string input; public Matrix(string input){ this.input = input; } public int[] Row(int row){drago18121996 (68)in ita • last monthBottleusing System; using System.Collections.Generic; public static class BottleSong{ static Dictionary numWord = new Dictionary{drago18121996 (68)in ita • 2 months agoEdin il sovrano...drago18121996 (68)in ita • 2 months agoWindow systemclass ProgramWindow{ public $x;drago18121996 (68)in ita • 4 months agoCountexport function nucleotideCounts(lett:string) { const res: Record = { A: 0, C: 0, G: 0, T: 0,}; // ricordarsi la virgola alla fine! for(let i=0; idrago18121996 (68)in ita • 4 months agoBinary searchexport function find(haystack: number[], needle: number, counter: number = 0): number | never { const maxNumber = Math.max(...haystack); let middle = Math.floor(haystack.length/2); if(needle ===…drago18121996 (68)in ita • 4 months agoHandshakelet arr : string[] =["wink" ,"double blink","close your eyes", "jump"]; export function commands(num: number): string[] { let res: string[] = []; const binArr = num.toString(2).padStart(5…drago18121996 (68)in ita • 4 months agoLengthexport function encode(text:string) { let res = ""; let num = 1; for(let i=0; idrago18121996 (68)in ita • 4 months agoBasesexport function convert( digits: number[], inputBase: number, outputBase: number ): number[] { let res: number[] = []; let resNum = 0; let exp = digits.length-1; let toAdd = 0; if…drago18121996 (68)in ita • 4 months agoSeriesexport class Series { series: string; constructor(series: string) { this.series = series; if(this.series.length === 0) throw new Error('series cannot be empty'); } slices(sliceLength:…drago18121996 (68)in ita • 5 months agoAffine{ let lower = phrase.toLowerCase().replaceAll(' ', ''); let alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m', 'n','o','p','q','r','s','t','u','v','w','x','y','z']; let m = 26;…drago18121996 (68)in ita • 5 months 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 months 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 • 5 months 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 • 5 months agoDiamontimport java.util.*; class DiamondPrinter { String repeatAllSegm(int count){drago18121996 (68)in ita • 6 months agoLindergarten// // 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 • 6 months agoGarden// // 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 • 6 months agoAngramexport class Anagram { input : string; constructor(input: string) { this.input = input.toLowerCase(); } public matches(...potentials: string[]): string[] { let res: string[] = []; let…drago18121996 (68)in ita • 6 months agoComplex 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; }…