Giter VIP home page Giter VIP logo

Comments (4)

KoEonYack avatar KoEonYack commented on September 27, 2024

@Woohwahwa

커밋 시간을 보고 입을 벌려보아요~!!

image

문제에서 테스트 같은 단어가 등장하는데 성화가 작업할때도 같은 결과가 나오나요???

const rl = require('readline').createInterface(process.stdin)

let count
const set = new Set()
rl.on('line', line => {
    if (!count) {
        count = +line
    } else {
        set.add(line)
        if (!--count) {
            const list = [...set]
            list.sort((s1, s2) => (s1.length - s2.length) || s1.localeCompare(s2))
            console.log(list.join('\n'))
        }
    }
})

localeCompare을 활용한 코드인데 살펴보아요~~

from baekjoon.

KoEonYack avatar KoEonYack commented on September 27, 2024

시간될 때 다른 궁금한것도 답을 남겨볼께요~

from baekjoon.

leedoopal avatar leedoopal commented on September 27, 2024
const output = input.sort((a, b) => a.length - b.length || a.localeCompare(b));
const result = Array.from(new Set(output));
console.log(result.join('\n'));

쌤 틀린 이유를 찾았어요! 제가 문제를 똑바로 안 본 나머지 중복 문자를 제거하라는 말을 놓쳤지 모예여..

근데 이번엔 중복 문자를 제거했는데 제출 형식이 잘못되었다고 나와요! node 로 실행했을 때 잘되는데 이유를 모르겠어요;;;

from baekjoon.

KoEonYack avatar KoEonYack commented on September 27, 2024
const [T, ...input] = require('fs').readFileSync('/dev/stdin').toString().split('\n');
let output = '';

const output = input.sort((a, b) => a.length - b.length || a.localeCompare(b));
const result = Array.from(new Set(output));
console.log(result.join('\n'));

console.log(output);

저 이렇게 돌려봤는데

5
a
bba
bbb
cc
bb

테스트케이스는 위에거!

image

이렇게 결과가나와요,,,! 무엇을 잘못한걸까요,,

from baekjoon.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.