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
export default class Store { | |
#state = {}; | |
#listeners = []; | |
#reducer; | |
/** | |
* 액션을 수행하고 새로운 state를 반환한다. dispatch를 통해 원하는 액션을 수행할 수 있다. | |
* @param {{}} state | |
* @param {{ payload: {} }} reducer | |
const reducer = (state, actionKey, { payload = {} }) => { |
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
🌞 Morning 75 commits █▍░░░░░░░░░░░░░░░░░░░ 6.7% | |
🌆 Daytime 209 commits ███▉░░░░░░░░░░░░░░░░░ 18.7% | |
🌃 Evening 454 commits ████████▌░░░░░░░░░░░░ 40.7% | |
🌙 Night 377 commits ███████░░░░░░░░░░░░░░ 33.8% |
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 axios from "axios" | |
import cheerio from "cheerio" | |
import iconv from "iconv-lite"; | |
const getDate = () => { | |
const date = new Date().toISOString().substring(0, 10) | |
const KO_DAY = ['일', '월', '화', '수', '목', '금', '토']; | |
return `${date} (${KO_DAY[new Date().getDay()]})` | |
} |
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
/** | |
* @arr 초기 배열 | |
* @compare 객체에 대한 비교 함수 | |
*/ | |
const PQ = (arr, compare = (a, b) => a > b) => { | |
const heap = []; | |
const getPIdx = (i) => Math.floor((i - 1) / 2); | |
const getLIdx = (i) => i * 2 + 1; | |
const getRIdx = (i) => i * 2 + 2; |
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 java.util.Arrays; | |
public class $ { | |
public static <T extends Comparable<T>> int compare(T a, T b) { | |
return a.compareTo(b); | |
} | |
public static <T extends Comparable<T>> void swap(T[] a, int i, int j) { | |
T tmp = a[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 java.io.*; | |
import java.util.*; | |
public class BinaryArrayTree { | |
private List<Integer> list = new ArrayList<>(); | |
public BinaryArrayTree(int n) { | |
list.add(null); | |
for (int i = 1; i <= n; i++) |