hackerrank.com
hackerrank.com Practice>Python>Strings>Merge the Tools!
건이두
2019. 2. 4. 20:16
728x90
hackerrank.com Practice>Python>Strings>Merge the Tools!
Merge the Tools!
Tip
- We can solve this problem with set
- However, better way, is the using string replacement
- Substring as per the length of k
- input is s
- pick the first character, and replace it to ''
- s.replace(s[0])
- Now, duplication of first character is resolve
- To apply the way, to whole string, please see below
- s[0:j] + s1[j:].replace(s1[j-1], '')
Solution
728x90