Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/chan9yu/algorithm-playground

✍🏼 algorithm playground repository
https://github.com/chan9yu/algorithm-playground

algorithm bfs-algorithm dfs-algorithm dynamic-programming javascript sorting-algorithms

Last synced: 1 day ago
JSON representation

✍🏼 algorithm playground repository

Awesome Lists containing this project

README

        

# πŸ§‘πŸ»β€πŸ’» Algorithm Playground

> κ³΅λΆ€ν•΄μ•Όν•΄μš” γ… γ… ...


## μ•Œκ³ λ¦¬μ¦˜ 정리

- [λ™μ κ³„νšλ²•(DP, Dynamic Programming)](https://github.com/chan9yu/algorithm-playground/blob/main/note/dynamic_programming.md)


## fs λͺ¨λ“ˆμ„ μ΄μš©ν•˜λŠ” 방법

### λ°±μ€€ 제좜용

1. ν•œ μ€„λ‘œ μž…λ ₯을 받을 λ•Œ

```js
const fs = require("fs");
const input = fs.readFileSync("/...").toString().split(" ");

const num = Number(input);

for (let i = 1; i <= num; i++) {
console.log(i);
}
```

2. μ—¬λŸ¬ μ€„λ‘œ μž…λ ₯을 받을 λ•Œ

```js
const fs = require("fs");
const input = fs.readFileSync("/...").toString().split("\n");
const numbers = [];

for (let i = 1; i < input.length; i++) {
if (input[i] !== "") {
numbers.push(input[i].split(" "));
}
}

for (let i = 0; i < numbers.length; i++) {
let num1 = Number(numbers[i][0]);
let num2 = Number(numbers[i][1]);
console.log(num1 + num2);
}
```