softnshare / kata

Code Kata 這個概念是由 The Pragmatic Programmer 的作者之一Dave Thomas提出的, 想要提升自己的coding skill嗎? 歡迎加入這個slack channel, 加入請參考右邊網頁說明
https://softnshare.wordpress.com/slack/kata/
38 stars 4 forks source link

Fake Binary #29

Open freedom5566 opened 6 years ago

freedom5566 commented 6 years ago

來源:https://www.codewars.com/kata/fake-binary

題目:

Given a string of digits, you should replace any digit below 5 with '0' and any digit 5 and above with '1'. Return the resulting string.

給一個字串,你要用0替換5以下的任何數字,用1替換5以上的任何數字,最後回傳字串。

P.S:5以下不包括5