전체 글

전체 글

    [LeetCode - Online Assessment 기출] Circular Printer

    [LeetCode - Online Assessment 기출] Circular Printer

    단어가 주어졌을때, 처음 알파벳 부터 각 알파벳에 맞게 포인터를 움직여야한다. 포인터의 첫번째 위치는 'A'이며, 포인터가 왼쪽, 오른쪽으로 움직일 때마다 1초씩 증가한다. 입력 & 출력 예제 case1 입력: "BZA" 출력: 4 case2 입력: "AZGB" 출력: 13 case3 입력: "ZNMD" 출력: 23 제한사항 1

    Transformers 란? 트랜스포머란?

    Transformers 란? 트랜스포머란?

    RNNS의 문제점 긴 문장을 다루기 어렵다 - information loss (정보가 손실 된다.) 학습이 어렵다. - 학습이 길어지면 Gradient(경사도)가 사라진다. 이러한 문제점들 때문에 Recuurent Connection이 없는 트랜스포머가 개발이 되었다. Transformer 구성요소 트랜스포머는 일련의 입력값들이 사용되며, 결과값은 입력 값의 길이와 같다. 예시: input(x1, ..., xn)와 output(y1, ..., yn) 트랜스포머는 트랜스포머 블록들을 Stack으로 구성한다. 각 트랜스포머는 간단한 Linear layers, Feed forward network layer, 그리고 self-attention layer들을 가지고 있다. Self-attention이란? Sel..

    [LeetCode - Didi labs 기출문제] 265. Paint House II

    265. Paint House II Hard There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color. The cost of painting each house with a certain color is represented by an n x k cost matrix costs. For example, costs[0][0] is the cost of..

    [LeetCode - Didi Labs 기출문제] 40. Combination Sum II

    40. Combination Sum II Medium Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target. Each number in candidates may only be used once in the combination. Note: The solution set must not contain duplicate combinations. Example 1: Input: candidates = [10,1,2,7,6,1,5], target = 8 Output:..

    [LeetCode - DiDi Labs 기출 문제] 17. Letter Combinations of a Phone Number

    [LeetCode - DiDi Labs 기출 문제] 17. Letter Combinations of a Phone Number

    17. Letter Combinations of a Phone Number Medium Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. Example 1: Input: digits = "23" Output: ["ad","ae","af","bd","be",..

    [LeetCode - DiDi Labs 기출 문제] 3Sum Closest

    16. 3Sum Closest Medium Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution. Example 1: Input: nums = [-1,2,1,-4], target = 1 Output: 2 Explanation: The sum that is closest to the target is 2. (-1 + 2 + 1 = 2). Example..

    [LeetCode] 1328. Break a Palindrome

    1328. Break a Palindrome Medium Given a palindromic string of lowercase English letters palindrome, replace exactly one character with any lowercase English letter so that the resulting string is not a palindrome and that it is the lexicographically smallest one possible. Return the resulting string. If there is no way to replace a character to make it not a palindrome, return an empty string. A..

    [LeetCode] 653. Two Sum IV - Input is a BST

    [LeetCode] 653. Two Sum IV - Input is a BST

    653. Two Sum IV - Input is a BST Easy Given the root of a Binary Search Tree and a target number k, return true if there exist two elements in the BST such that their sum is equal to the given target. Example 1: Input: root = [5,3,6,2,4,null,7], k = 9 Output: true Example 2: Input: root = [5,3,6,2,4,null,7], k = 28 Output: false Constraints: The number of nodes in the tree is in the range [1, 10..