알고리즘문제풀이

    [프로그래머스][python] 12925. 문자열을 정수로 바꾸기

    Question: 문자열 s를 숫자로 변환한 결과를 반환하는 함수, solution을 완성하세요. 제한사항 s의 길이는 1 이상 5이하입니다. s의 맨앞에는 부호(+, -)가 올 수 있습니다. s는 부호와 숫자로만 이루어져있습니다. s는 0으로 시작하지 않습니다. Example: numbersresult예를들어 str이 1234이면 1234를 반환하고, -1234이면 -1234를 반환하면 됩니다. str은 부호(+,-)와 숫자로만 구성되어 있고, 잘못된 값이 입력되는 경우는 없습니다. My answer: def solution(s): return int(s) 쉬운 문제였지만 포스팅 한 이유는 reference code가 인상적이었기 때문이다. reference code: def strToInt(str):..

    [프로그래머스][python] 12918. 문자열 다루기 기본

    programmers.co.kr/learn/courses/30/lessons/12918 코딩테스트 연습 - 문자열 다루기 기본 문자열 s의 길이가 4 혹은 6이고, 숫자로만 구성돼있는지 확인해주는 함수, solution을 완성하세요. 예를 들어 s가 a234이면 False를 리턴하고 1234라면 True를 리턴하면 됩니다. 제한 사항 s는 길이 1 이 programmers.co.kr Question: 문자열 s의 길이가 4 혹은 6이고, 숫자로만 구성돼있는지 확인해주는 함수, solution을 완성하세요. 예를 들어 s가 a234이면 False를 리턴하고 1234라면 True를 리턴하면 됩니다. 제한사항 s는 길이 1 이상, 길이 8 이하인 문자열입니다. Example: s return a234 fals..

    [프로그래머스][python] 12916. 문자열 내 p와 y의 개수

    programmers.co.kr/learn/courses/30/lessons/12916 코딩테스트 연습 - 문자열 내 p와 y의 개수 대문자와 소문자가 섞여있는 문자열 s가 주어집니다. s에 'p'의 개수와 'y'의 개수를 비교해 같으면 True, 다르면 False를 return 하는 solution를 완성하세요. 'p', 'y' 모두 하나도 없는 경우는 항상 True를 programmers.co.kr Question: 대문자와 소문자가 섞여있는 문자열 s가 주어집니다. s에 'p'의 개수와 'y'의 개수를 비교해 같으면 True, 다르면 False를 return 하는 solution를 완성하세요. 'p', 'y' 모두 하나도 없는 경우는 항상 True를 리턴합니다. 단, 개수를 비교할 때 대문자와 소문..

    [프로그래머스][python] 12912. 두 정수 사이의 합

    programmers.co.kr/learn/courses/30/lessons/12912?language=python3 코딩테스트 연습 - 두 정수 사이의 합 두 정수 a, b가 주어졌을 때 a와 b 사이에 속한 모든 정수의 합을 리턴하는 함수, solution을 완성하세요. 예를 들어 a = 3, b = 5인 경우, 3 + 4 + 5 = 12이므로 12를 리턴합니다. 제한 조건 a와 b가 같은 경우 programmers.co.kr Question: 두 정수 a, b가 주어졌을 때 a와 b 사이에 속한 모든 정수의 합을 리턴하는 함수, solution을 완성하세요. 예를 들어 a = 3, b = 5인 경우, 3 + 4 + 5 = 12이므로 12를 리턴합니다. 제한사항 a와 b가 같은 경우는 둘 중 아무 수..

    [codesignal][python] 10. Sort by Height

    codesignal.com Coding Tests and Assessments for Technical Hiring | CodeSignal Learn how you can go beyond resumes in technical hiring with a state-of-the-art assessment platform and advanced coding tests codesignal.com level : easy Question: Some people are standing in a row in a park. There are trees between them which cannot be moved. Your task is to rearrange the people by their heights in a ..

    [codesignal][python] 9. isLucky

    codesignal.com Coding Tests and Assessments for Technical Hiring | CodeSignal Learn how you can go beyond resumes in technical hiring with a state-of-the-art assessment platform and advanced coding tests codesignal.com level : easy Question: Ticket numbers usually consist of an even number of digits. A ticket number is considered lucky if the sum of the first half of the digits is equal to the s..

    [codesignal][python] 8. commonCharacterCount

    codesignal.com Coding Tests and Assessments for Technical Hiring | CodeSignal Learn how you can go beyond resumes in technical hiring with a state-of-the-art assessment platform and advanced coding tests codesignal.com level : easy Question: Given two strings, find the number of common characters between them. 두 string이 주어지면 서로 같은 겹치는 요소의 개수를 반환하는 문제 Example: For s1 = "aabcc" and s2 = "adcaa", t..

    [codesignal][python] 7. AllLongestStrings

    codesignal.com Coding Tests and Assessments for Technical Hiring | CodeSignal Learn how you can go beyond resumes in technical hiring with a state-of-the-art assessment platform and advanced coding tests codesignal.com level : easy Question: Given an array of strings, return another array containing all of its longest strings. Example: For inputArray = ["aba", "aa", "ad", "vcd", "aba"], the outp..

    [프로그래머스][python] 68644. 두 개 뽑아서 더하기

    programmers.co.kr/learn/courses/30/lessons/68644 코딩테스트 연습 - 두 개 뽑아서 더하기 정수 배열 numbers가 주어집니다. numbers에서 서로 다른 인덱스에 있는 두 개의 수를 뽑아 더해서 만들 수 있는 모든 수를 배열에 오름차순으로 담아 return 하도록 solution 함수를 완성해주세요. 제한 programmers.co.kr 월간코드 챌린지 시즌 1 Question: 정수 배열 numbers가 주어집니다. numbers에서 서로 다른 인덱스에 있는 두 개의 수를 뽑아 더해서 만들 수 있는 모든 수를 배열에 오름차순으로 담아 return 하도록 solution 함수를 완성해주세요. 제한사항 numbers의 길이는 2 이상 100 이하입니다. numbe..

    [codesignal][python] 6. matirxElementsSum

    codesignal.com Coding Tests and Assessments for Technical Hiring | CodeSignal Learn how you can go beyond resumes in technical hiring with a state-of-the-art assessment platform and advanced coding tests codesignal.com level : easy Question: After becoming famous, the CodeBots decided to move into a new building together. Each of the rooms has a different cost, and some of them are free, but the..