python(18)
-
[Python 문제풀이] 15일차
Day_15 Intro Q22. avoidObstacles You are given an array of integers representing coordinates of obstacles situated on a straight line. Assume that you are jumping from the point with coordinate 0 to the right. You are allowed only to make jumps of the same length represented by some integer. Find the minimal length of the jump enough to avoid all the obstacles. 제출 코드 from math import gcd def sol..
2020.07.23 -
[Python 문제풀이] 13일차
Day_13 Intro Q21. isIPv4Address An IP address is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. There are two versions of the Internet protocol, and thus two versions of addresses. One of them is the IPv4 address. 제출 코드 def isIPv4Address(inputString): dotidxlist = [] if len(inputString) >=..
2020.07.21 -
[Python 문제풀이] 12일차
Day_12 Intro Q19. areEquallyStrong Call two arms equally strong if the heaviest weights they each are able to lift are equal. Call two people equally strong if their strongest arms are equally strong (the strongest arm can be both the right and the left), and so are their weakest arms. Given your and your friend's arms' lifting capabilities find out if you two are equally strong. 제출 코드 d..
2020.07.20 -
[Python 문제풀이] 10일차
Day_10 Intro Q16. Are Similar? Two arrays are called similar if one can be obtained from another by swapping at most one pair of elements in one of the arrays. Given two arrays a and b, check whether they are similar. 제출 코드 def areSimilar(a, b): if a == b: # 둘이 같으면 참 return True else: # 다를 때 # 정렬한 값이 같은 경우, 스왑해야하는 갯수를 체크하면 된다 c = sorted(a) d = sorted(b) diffCount = 0 # 정렬한 값이 같은 경우 if c == d: fo..
2020.07.18 -
[Python 문제풀이] 9일차
Day_9 Intro Q14. alternatingSums Several people are standing in a row and need to be divided into two teams. The first person goes into team 1, the second goes into team 2, the third goes into team 1 again, the fourth into team 2, and so on. You are given an array of positive integers - the weights of the people. Return an array of two integers, where the first element is the total weight of tea..
2020.07.17 -
[Python 문제풀이] 8일차
Day_8 Intro Q13. reverseInParentheses Write a function that reverses characters in (possibly nested) parentheses in the input string. Input strings will always be well-formed with matching ()s. def reverseInParentheses(inputString): #[출처] [python] codeSignal 문제풀이 (13~15)|작성자 Jun s = inputString while '(' in s : #괄호가 다 없어질때까지 반복 fb = s.rfind('(') # rfind : 뒤에서부터 문자열 탐색 bb = s[fb:]..
2020.07.16