1.문제 integer로 이루어진 배열이 주어지고, 짝수 자릿수가 몇 개인지를 반환한다. Screen Shot 2019-12-28 at 11.25.55 PM.png 2.접근 // nums에는 다양한 자리수의 배열이 들어온다. // 각 요소를 확인한다. // 10으로 나눠지는 횟수에 1을 더하면 그 수의 자리수이다. // 예를 ...
golang을 공부하면서, 동시에 알고리즘 문제풀기
1.문제 IPv4형식의 IP주소가 입력되고, defanged version의 IP 주소를 반환한다. (점은 대괄호 처리) Screen Shot 2019-12-29 at 7.42.37 PM.png 2.접근 // go에서 제공하는 치환함수를 쓰자 // strings.ReplaceAll() 3. 내가 작성한 답 처음엔 ReplaceAll()을...
1.문제 integer숫자가 입력된다. 모든 자릿수의 곱과 합의 차이를 반환한다. Screen Shot 2019-12-30 at 2.32.02 PM.png 2.접근 // 10으로 나눈 나머지가 1의 자리수가 된다. // 그 몫을 다시 10으로 나누면 10의 자릿수가 된다. // 10으로 나눈 몫이 0이 되면 마지막 수가 구해진 것이므...
1.문제 보석을 대변하는 문자열 J가 주어지고, 원석으로 대변되는 문자열 S가 주어진다. J는 S에서 보석을 구분할 수 있는 문자열이 들어있다. S에 얼마나 많은 보석이 포함되어 있는지를 반환한다. 대소문자를 구분한다. Screen Shot 2019-12-31 at 10.20.18 AM.png 2.접근 // 주어진 J를 각 문자에 대한 배열로 만든...
1.문제 단일연결리스트로 주어지는 head가 주어진다. 연결리스트의 각 노드 값은 0 또는 1이다. 즉 리스트는 이진수이다. 십진수를 반환하라. Screen Shot 2020-01-01 at 6.18.19 PM.png 2.접근 // 리스트 내부 값을 모두 JOIN한다. // 조인된 값을 십진수로 변환한다. 3. 내가 작성한 답 (오답) ...
1.문제 We are given a list nums of integers representing a list compressed with run-length encoding. Consider each adjacent pair of elements [a, b] = [nums[2i], nums[2i+1]] (with i >= 0). For each suc...
1. 문제 Balanced strings are those who have equal quantity of 'L' and 'R' characters. Given a balanced string s split it in the maximum amount of balanced strings. Return the maximum amount of splitte...
1. 문제 Given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6). Example 1: Example 2: Exam...
1. 문제 Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The binary search tree is guaranteed to have unique values. Example 1...
1. 문제 On a plane there are n points with integer coordinates points[i] = [xi, yi]. Your task is to find the minimum time in seconds to visit all point
1. 문제 Table: Department Write an SQL query to reformat the table such that there is a department id column and a revenue column for each month. The
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
Given a 32-bit signed integer, reverse digits of an integer.