Coding Test

https://leetcode.com/problems/greatest-common-divisor-of-strings/description/?envType=study-plan-v2&envId=leetcode-75 Greatest Common Divisor of Strings - LeetCode Can you solve this real interview question? Greatest Common Divisor of Strings - For two strings s and t, we say "t divides s" if and only if s = t + ... + t (i.e., t is concatenated with itself one or more times). Given two strings s..
https://leetcode.com/problems/merge-strings-alternately/description/?envType=study-plan-v2&envId=leetcode-75 Merge Strings Alternately - LeetCode Can you solve this real interview question? Merge Strings Alternately - You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additiona..
https://www.acmicpc.net/problem/14888 14888번: 연산자 끼워넣기 첫째 줄에 수의 개수 N(2 ≤ N ≤ 11)가 주어진다. 둘째 줄에는 A1, A2, ..., AN이 주어진다. (1 ≤ Ai ≤ 100) 셋째 줄에는 합이 N-1인 4개의 정수가 주어지는데, 차례대로 덧셈(+)의 개수, 뺄셈(-)의 개수, 곱 www.acmicpc.net 아이디어 해당 문제는 dfs를 사용하여 풀었다. 문제를 풀면서 나눗셈을 처리하기 위해 처음에는 //연산자를 사용했지만, 자꾸 답이 다르게 나오는 오류가 있었다. print(int ( -1 / 3)) # 0 print(-1 // 3) # -1 오류를 바로잡기 위해서는 위 두 연산의 차이를 알아야했다. 파이썬의 -1 // 3 연산이 -1을 반..
https://www.acmicpc.net/problem/14503 14503번: 로봇 청소기 첫째 줄에 방의 크기 $N$과 $M$이 입력된다. $(3 \le N, M \le 50)$ 둘째 줄에 처음에 로봇 청소기가 있는 칸의 좌표 $(r, c)$와 처음에 로봇 청소기가 바라보는 방향 $d$가 입력된다. $d$가 $0$인 경우 북쪽 www.acmicpc.net 아이디어 순서도에 적힌대로 구현하면 되는 문제였다. 해당 문제에는 로봇 청소기가 바라보는 방향 정보를 가지고있다. 본문에는 아래와 같이 써져있다. 로봇 청소기가 바라보는 방향 d가 입력된다. d가 0인 경우 북쪽, 1인 경우 동쪽, 2인 경우 남쪽, 3인 경우 서쪽을 바라보고 있는 것이다. 그래서 우선 방향 이동 벡터는 0번째에 북쪽을 바라보고 직..
lim.dev
'Coding Test' 카테고리의 글 목록 (21 Page)