This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function funWithAnagrams(text) { | |
let arr = [text[0]]; | |
const areTheSameAnagram = (a,b) => | |
a.split('').sort().join('') === b.split('').sort().join(''); | |
text.forEach( e => | |
!arr.find(ee => areTheSameAnagram(e, ee)) && arr.push(e) | |
) | |
return arr.sort() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1 цель: надо собрать перебрать подстроки по макс. | |
// длине подстроки с неважно каким порядком, главное не алфавитное сортировка | |
// а максимально подборка неповторимых букв с возможным повторение друг за другом | |
const ss1 = 'ab'; | |
const ss2 = 'cba'; | |
const ss3 = 'ccabb'; | |
const temp = 'abccbbacaaaba'; | |
type indexes = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function survivors(movs: number[], pws: number[][]): number[] { | |
const final:number[] = pws.reduce((acc:number[],n:number[],jj:number):number[] => { | |
const sum = n.reduce((s,nxt) => s + nxt, movs[jj]); | |
console.log(sum,jj, n.length-1, movs[jj]) | |
const checkMovement = (n.length === 0 && sum > 0) || (sum-n.length > 0); | |
return checkMovement ? [...acc, jj] : acc | |
}, []) | |
return final | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function translate(speech: string, vocabulary: string[]): string { | |
const candidates = speech.matchAll(/[\*|\w]+/g); | |
for (let c of candidates) { | |
} | |
const sortedByAsteriskAmmount = [...candidates].sort((p,n) => { | |
const pAstr = [...p[0].matchAll(/\*/g)].length; | |
const nAstr = [...n[0].matchAll(/\*/g)].length; | |
return pAstr === nAstr ? 0 : (pAstr > nAstr ? 1 : -1) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
course: udemy.com/course/symfony-framework-hands-on/ | |
Plugins (search for them on the Extensions tab): | |
Auto Close Tags | |
PHP Intelephense | |
PHP Namespace Resolver | |
Rainbow Brackets | |
Twig | |
Themes | |
One Dark Pro |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends, typeof, keyof - https://www.youtube.com/watch?v=L1ONtRnIxcY |
OlderNewer