일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- Github
- 제노블레이드 2
- git
- SRE
- 취준
- 백트래킹
- programmers
- LeetCode
- GitHub Desktop
- 프로그래머스
- 프로콘 갈림현상
- 코딩테스트
- 네이버 검색 시스템
- Algorithmus
- DP
- C++
- 리트코드
- 격리수준
- Pro-Con
- Python
- 프로콘
- algorithm
- 알고리즘
- 자소서
- 알고리즘 종류 정리
- python3
- baekjoon
- 백준
- ASF-110
- Ultimate Search
- Today
- Total
목록전체 글 (76)
산타는 없다
문제 원문 문제 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 A와 B가 주어진다. (0 < A, B < 10¹⁰⁰⁰⁰) 출력 첫째 줄에 A+B를 출력한다. 예제 풀이 자릿수가 10의 만 제곱이기 때문에 Integer 자료형으로는 처리할 수 없고 string이나 int나 char의 배열을 사용해야 하는데 저는 string을 사용하여 풀었습니다 입력받은 각 문자열의 맨 뒤부터 시작하여 전체 순회하였으며 먼저 끝나는 수에 대한 예외처리를 해주었습니다. 계산은 각 문자열 자릿수와 carry값을 더하는 것으로 진행하였고 계산한 값이 10 이상이면 carry을 true 처리하여 자리 올림수를 처리하였습니다. 문자열을 모두 순회한 후 마지막 carry값이 true일 경..
문제 원문 문제 정수 X에 사용할 수 있는 연산은 다음과 같이 세 가지 이다. X가 3으로 나누어 떨어지면, 3으로 나눈다. X가 2로 나누어 떨어지면, 2로 나눈다. 1을 뺀다. 정수 N이 주어졌을 때, 위와 같은 연산 세 개를 적절히 사용해서 1을 만들려고 한다. 연산을 사용하는 횟수의 최솟값을 출력하시오. 입력 첫째 줄에 1보다 크거나 같고, 106보다 작거나 같은 정수 N이 주어진다. 출력 첫째 줄에 연산을 하는 횟수의 최솟값을 출력한다. 풀이 DP를 활용하는 문제입니다 상황은 세 가지로 i - 1 의 횟수에서 1을 더한 값 2로 나누어 떨어질 때 i / 2의 횟수에서 1을 더한 값 3으로 나누어 떨어질 때 1 / 3의 횟수에서 1을 더한 값 중에 가장 적은 값을 저장하면 됩니다. 이에 대한 점화..
문제 원문 Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Follow up: Could you solve it without converting the integer to a string? Example 1: Input: x = 121 Output: true Example 2: Input: x = -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Ex..
문제 원문 Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value. The string can contain additional characters..
문제 원문 Given a 32-bit signed integer, reverse digits of an integer. Note:Assume we are dealing with an environment that could only store integers within the 32-bit signed integer range: [-2³¹, 2³¹ − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows. Example 1: Input: x = 123 Output: 321 Example 2: Input: x = -123 Output: -321 Example 3: I..
문제 원문 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a string and make this conversion given a number of rows: string convert(string s, int numRows); Constraints: 1
문제 원문 Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. Follow up: The overall run time complexity should be O(log (m+n)). Example 1: Input: nums1 = [1,3], nums2 = [2] Output: 2.00000 Explanation: merged array = [1,2,3] and median is 2. Example 2: Input: nums1 = [1,2], nums2 = [3,4] Output: 2.50000 Explanation: merged array = [1,2,3..
문제 원문 문제 수를 처리하는 것은 통계학에서 상당히 중요한 일이다. 통계학에서 N개의 수를 대표하는 기본 통계값에는 다음과 같은 것들이 있다. 단, N은 홀수라고 가정하자. 산술평균 : N개의 수들의 합을 N으로 나눈 값 중앙값 : N개의 수들을 증가하는 순서로 나열했을 경우 그 중앙에 위치하는 값 최빈값 : N개의 수들 중 가장 많이 나타나는 값 범위 : N개의 수들 중 최댓값과 최솟값의 차이 N개의 수가 주어졌을 때, 네 가지 기본 통계값을 구하는 프로그램을 작성하시오. 입력 첫째 줄에 수의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 그 다음 N개의 줄에는 정수들이 주어진다. 입력되는 정수의 절댓값은 4,000을 넘지 않는다. 출력 첫째 줄에는 산술평균을 출력한다. 소수점 이하 첫째 자리에..