BigO

Run Settings
LanguageJavaScript
Language Version
Run Command
// O(n) let nemo = ['nemo']; const findNemo = (array) => { for (let i = 0; i < array.length; i++) { if (array[i] === 'nemo') { console.log('Founded!'); } } }; findNemo(nemo); // 0(1) const compressBoxes = (boxes) => console.log(boxes[0]) compressBoxes([1, 1, 2, 3]) // O(n^2) // log all pairs const logAllPairs = (array) => { for (let i = 0; i < array.length; i++) { for (let j = 0; j < array.length; j++) { console.log(array[i], array[j]); } } }; // compare a los of tweets o(n^2) // 'gdfgfdgfdgdf'.length as in javascript everything is an object, is o(1) // access to the property of an object
Editor Settings
Theme
Key bindings
Full width
Lines