diff --git a/code_study/Baekjoon/ts/1015.ts b/code_study/Baekjoon/ts/1015.ts new file mode 100644 index 0000000..e73e092 --- /dev/null +++ b/code_study/Baekjoon/ts/1015.ts @@ -0,0 +1,15 @@ +export {}; + +const input: string[] = require("fs").readFileSync(0).toString().trim().split('\n'); +const N: number = Number(input[0]); +const A: number[] = input[1].split(' ').map(Number); + +const sortedA: number[] = A.slice(0).sort((a,b) => a-b); +const P: number[] = new Array(N).fill(-1); +A.forEach((v,i) => { + P[i] = sortedA.findIndex((val, idx) =>{ + if (val===v && !(P.includes(idx))) return true; + }); +}); + +console.log(P.join(' '));