• Nov 19, 2022 •CodeCatch
0 likes • 1 view
// There are n rings and each ring is either red, green, or blue. The rings are distributed across ten rods labeled from 0 to 9. // You are given a string rings of length 2n that describes the n rings that are placed onto the rods. Every two characters in rings forms a color-position pair that is used to describe each ring where: // The first character of the ith pair denotes the ith ring's color ('R', 'G', 'B'). // The second character of the ith pair denotes the rod that the ith ring is placed on ('0' to '9'). // For example, "R3G2B1" describes n == 3 rings: a red ring placed onto the rod labeled 3, a green ring placed onto the rod labeled 2, and a blue ring placed onto the rod labeled 1. // Return the number of rods that have all three colors of rings on them. let rings = "B0B6G0R6R0R6G9"; var countPoints = function(rings) { let sum = 0; // Always 10 Rods for (let i = 0; i < 10; i++) { if (rings.includes(`B${i}`) && rings.includes(`G${i}`) && rings.includes(`R${i}`)) { sum+=1; } } return sum; }; console.log(countPoints(rings));
• Aug 30, 2024 •C S
1 like • 18 views
# Acronyms ## Computer Numerical Control (CNC) - Typicalldfdfsdffdafdasgfdgfgfdfdafdasfdafda
• Nov 8, 2023 •LeifMessinger
0 likes • 6 views
function copyString(text){ async function navigatorClipboardCopy(text){ if(document.location.protocol != "https:"){ return false; } return new Promise((resolve, reject)=>{ navigator.clipboard.writeText(text).then(()=>{resolve(true);}, ()=>{resolve(false);}); }); } function domCopy(text){ if(!(document.execCommand)){ console.warn("They finally deprecated document.execCommand!"); } const input = document.createElement('textarea'); input.value = text; document.body.appendChild(input); input.select(); const success = document.execCommand('copy'); document.body.removeChild(input); return success; } function promptCopy(){ prompt("Copy failed. Might have ... somewhere. Check console.", text); console.log(text); } function done(){ alert("Copied to clipboard"); } navigatorClipboardCopy(text).catch(()=>{return false;}).then((success)=>{ if(success){ done(); }else{ if(domCopy(text)){ done(); }else{ promptCopy(); } } }); }
• Sep 13, 2023 •C S
0 likes • 2 views
/** * @param {number[]} nums * @return {boolean} */ var containsDuplicate = function(nums) { return new Set(nums).size !== nums.length };
• Apr 26, 2025 •hasnaoui1
console.log("xa")
• Aug 2, 2025 •hasnaoui1