This file contains 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 hasPairWithSum(nums, sum) { | |
const set = new Set() | |
let sumArr = [] | |
for (let i = 0; i < nums.length; i++) { | |
const complement = sum - nums[i] | |
if (set.has(complement)) { | |
sumArr = [[...set].indexOf(complement), i] | |
} else { | |
set.add(nums[i]) |
This file contains 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
import React, { useState, useCallback } from "react"; | |
const todos = [ | |
{ | |
name: "TODO Task No.0", | |
id: 8598554 | |
}, | |
{ | |
name: "TODO Task No.1", | |
id: 189730 |
This file contains 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 findPeak(arr) { | |
const peaks = [] | |
let num = 0 | |
let occur = 0 | |
arr.forEach(item => { | |
for (let i = item.min; i < item.max; i++) { | |
peaks.push(i) | |
} | |
}) |
This file contains 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
const shuffle = arr => arr.sort(() => 0.5 - Math.random()) |
This file contains 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
sudo apt-get install -y curl | |
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
sudo apt-get install -y htop | |
sudo apt-get install -y vscode | |
sudo apt-get install -y git | |
sudo apt-get install -y libxss1 libappindicator1 libindicator7 | |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
sudo dpkg -i google-chrome*.deb |
This file contains 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
sudo eopkg install -y git | |
sudo eopkg install -y atom | |
sudo eopkg it gnome-tweak-tool | |
apm install color-picker file-icons minimap | |
apm install linter-csslint linter-eslint linter-js-yaml | |
sudo eopkg it -y neofetch | |
sudo eopkg bi --ignore-safety https://raw.githubusercontent.com/solus-project/3rd-party/master/network/web/browser/google-chrome-stable/pspec.xml | |
sudo eopkg it -y google-chrome-*.eopkg;sudo rm google-chrome-*.eopkg |