본문 바로가기

Python130

LeetCode 344. Reverse String [Easy] 문제: Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. You may assume all the characters consist of printable ascii characters. Example 1: Input: ["h","e","l","l","o"] Output: ["o","l","l","e","h"] Example 2: Input: ["H",".. 2020. 5. 20.
CodeSignal [29/60] chessBoardCellColor 문제: Given two cells on the standard chess board, determine whether they have the same color or not. Example: For cell1 = "A1" and cell2 = "C3", the output should be chessBoardCellColor(cell1, cell2) = true. For cell1 = "A1" and cell2 = "H3", the output should be chessBoardCellColor(cell1, cell2) = false. -문제해결 정리- 1. Cell 1 과 Cell 2가 색이 같아질 모든 True 값에 대하여 비교하고, 참이면 Return 아닐경우에는 False Return (Br.. 2020. 5. 20.
CodeSignal [28/60] alphabeticShift 문제: Given a string, your task is to replace each of its characters by the next one in the English alphabet; i.e. replace a with b, replace b with c, etc (z would be replaced by a). Example For inputString = "crazy", the output should be alphabeticShift(inputString) = "dsbaz". -문제해결 정리- 1. inputString에서 각 알파벳의 바꾼 값을 넣어줄 ans_list 를 만들어 준다. 2. inputString안에 있는 각 알파벳을 loop을 돌며 ascii code 값에서 +1 을 해준.. 2020. 5. 19.
CodeSignal [27/60] variableName 문제: Correct variable names consist only of English letters, digits and underscores and they can't start with a digit. Check if the given string is a correct variable name. Example For name = "var_1__Int", the output should be variableName(name) = true; For name = "qq-q", the output should be variableName(name) = false; For name = "2w2", the output should be variableName(name) = false. -문제 해결 정리-.. 2020. 5. 18.