The Office III - Broken Photocopier
Last updated
Was this helpful?
Last updated
Was this helpful?
์คํผ์ค 3ํ ์ ๋์ด๋๊ฐ ๋ฎ์์ง๋๊ฐ.. :disappointed:
The bloody photocopier is broken... Just as you were sneaking around the office to print off your favourite binary code! Instead of copying the original, it reverses it: '1' becomes '0' and vice versa. Given a string of binary, return the version the photocopier gives you as a string.
ํผ๋ฌป์(?) ๋ณต์ฌ๊ธฐ๊ฐ ๊ณ ์ฅ๋ฌ๋๋ฐ.. ๋ณต์ฌ๋ฅผ ํ๋ฉด 0 -> 1๋ก 1 -> 0์ผ๋ก ๋๋ค.
Sample Tests
๋งค๊ฐ๋ณ์๋ฅผ String.prototype.split()์ ์ด์ฉํด string์ ๋ฐฐ์ด๋ก ๋ง๋ ๋ค.
๋ฐฐ์ด์ด ๋ x๋ฅผ Array.prototype.map()์ ์ฌ์ฉํด ์์ ํ๋ํ๋์ ์ ๊ทผํ์ฌ 0 -> 1, 1 -> 0์ผ๋ก
๋ฐ๊ฟ ์๋ก์ด ๋ฐฐ์ด์ return ํ๋ค.
Array.prototype.join()์ผ๋ก string์ผ๋ก returnํ๋ค.
๋๋ค ํ ์คํธ ํต๊ณผ
์์ ๋ด ์์ค์์
๊ฐ ์์ฌ์ ๋๋ฐ ์ด ๋ถ๋ถ์
์ด๋ ๊ฒ arrow ํจ์์ ํ์ค return์ผ๋ก ์ฌ์ฉํ ๊ป ์์ฌ์์ด ๋จ๋๋ค.
@, , 's Solution