티스토리 뷰
1. Write a function that returns the sum of two numbers.
- Example)
-> For param1 = 1 and param2 = 2, the output should be add(param1, param2) = 3.
def add(param1, param2):
return param1 + param2
2. Given a year, return the century it is in.The first century spans from the year 1 up to and including the year 100, the second - from the year 101 up to and including the year 200, etc.
- Example)
-> For year = 1905, the output should be centuryFromYear(year) = 20
-> For year = 1700, the output should be centuryFromYear(year) = 17
def centuryFromYear(year):
return (year-1) // 100 + 1
3. Given the string, check if it is a palindrome.
- Example)
-> For inputString = "aabaa", the output should be checkPalindrome(inputString) = true.
-> For inputString = "abac", the output should be checkPalindrome(inputString) = false.
-> For inputString = "a", the output should be checkPalindrome(inputString) = true.
def checkPalindrome(inputString):
return inputString == inputString[::-1]
'Codesignal' 카테고리의 다른 글
code signal - 10. commonCharacterCount (0) | 2020.01.29 |
---|---|
code signal - 9. All Longest Strings (0) | 2020.01.29 |
code signal - 8. matrixElementsSum (0) | 2020.01.29 |
code signal - 7.almostIncreasingSequence (0) | 2020.01.29 |
codesignal 4-6 문제풀이 (0) | 2020.01.14 |
댓글