일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Kaggle
- 편스토랑
- leetcode
- gs25
- 우분투
- PYTHON
- 더현대서울 맛집
- 자연어처리
- SW Expert Academy
- 맥북
- hackerrank
- AI 경진대회
- 캐치카페
- ChatGPT
- programmers
- ubuntu
- Real or Not? NLP with Disaster Tweets
- 프로그래머스
- 프로그래머스 파이썬
- Docker
- 파이썬
- 코로나19
- 백준
- Baekjoon
- 데이콘
- 편스토랑 우승상품
- 금융문자분석경진대회
- github
- Git
- dacon
- Today
- Total
목록
반응형
leetcode (208)
솜씨좋은장씨
코딩 1일 1문제! 오늘의 문제는 leetCode 의 Rotate String 입니다. Rotate String - LeetCode Can you solve this real interview question? Rotate String - Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s. A shift on s consists of moving the leftmost character of s to the rightmost position. leetcode.com 👨🏻💻 문제 풀이 입력받은 문자열 s 에서 뒤쪽부터 문자를 하나씩 pop 해온 뒤 pop 해온 값..
코딩 1일 1문제! 오늘의 문제는 leetCode 의 Circular Sentence 입니다. Circular Sentence - LeetCode Can you solve this real interview question? Circular Sentence - A sentence is a list of words that are separated by a single space with no leading or trailing spaces. * For example, "Hello World", "HELLO", "hello world hello world" are all sentences. Words leetcode.com 👨🏻💻 문제 풀이 단어 2개씩 짝 지은 후 반복문을 돌면서 단어의 맨 뒷 글자와 ..
코딩 1일 1문제! 오늘의 문제는 leetCode 의 Find the Difference of Two Arrays 입니다. Find the Difference of Two Arrays - LeetCode Can you solve this real interview question? Find the Difference of Two Arrays - Given two 0-indexed integer arrays nums1 and nums2, return a list answer of size 2 where: * answer[0] is a list of all distinct integers in nums1 which are not present in nums2 leetcode.com 👨🏻💻 문제 풀이 set..
코딩 1일 1문제 오늘의 문제는 leetCode 의 Check if Every Row and Column Contains All Numbers 입니다. Check if Every Row and Column Contains All Numbers - LeetCode Can you solve this real interview question? Check if Every Row and Column Contains All Numbers - An n x n matrix is valid if every row and every column contains all the integers from 1 to n (inclusive). Given an n x n integer matrix matrix, return tru..
코딩 1일 1문제! 오늘의 문제는 leetCode 의 Number of Zero-Filed Subarrays 입니다. Number of Zero-Filled Subarrays - LeetCode Can you solve this real interview question? Number of Zero-Filled Subarrays - Given an integer array nums, return the number of subarrays filled with 0. A subarray is a contiguous non-empty sequence of elements within an array. Example 1: Input: nums = leetcode.com 👨🏻💻 문제 풀이 - SOMJANG 정답..
코딩 1일 1문제! 오늘의 문제는 leetCode 의 Minimum Absolute Difference 입니다. Minimum Absolute Difference - LeetCode Can you solve this real interview question? Minimum Absolute Difference - Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements. Return a list of pairs in ascending order(with respect t leetcode.com 👨🏻💻 문제 풀이 - SOMJANG 입력 받은..
코딩 1일 1문제! 오늘의 문제는 leetCode의 1844번 Replace All Digits with Characters 입니다. Replace All Digits with Characters - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 문제 풀이 enumerate, isdigit, ord와 chr을 활용하여 문제를 풀었습니다. 입력받은 문자열에서 하나씩 꺼내오면서 숫자일 경우에 이전 단어를 꺼내서 ord로 숫자로 바꾸어준 다음 숫자를 더하고 ..
코딩 1일 1문제! 오늘의 문제는 leetCode의 1748번 문제인 Sum of Unique Elements 입니다. Sum of Unique Elements - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 문제 풀이 collections의 Counter를 활용하여 리스트 내의 각 숫자 들이 각각 몇 번 씩 나오는지 확인 한 뒤 .items를 활용하여 ( 숫자, 등장 횟수 ) 로 바꾼 뒤 각 값들 중에 등장 횟수가 1인 것들의 숫자만 남겨준 뒤 un..
코딩 1일 1문제! 오늘의 문제는 leetCode의 1880번 Check if Word Equals Summation of Two Words 입니다. Check if Word Equals Summation of Two Words - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 문제 풀이 단어 3개가 주어지고 앞의 두개의 단어를 숫자로 변환한 다음 더한 값이 마지막 세번째 단어를 숫자로 변환한 값과 같은지 다른지를 확인하는 문제입니다. 단어를 숫자로 변..
코딩 1일 1문제! 오늘의 문제는 leetCode의 1859번 문제인 Sorting the Sentence 입니다. Sorting the Sentence - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 문제 풀이 공백을 기준으로 여러개 이어붙어있는 단어가 주어지면 각 단어 마지막에 붙어있는 숫자를 보고 다시 단어들을 재 정렬한 다음 이를 다시 문장으로 만들어주는 문제입니다. Input: s = "is2 sentence4 This1 a3" Output:..
코딩 1일 1문제! 오늘의 문제는 leetCode의 2119번 A Number After a Double Reversal 입니다. A Number After a Double Reversal - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 코드 ( Solution ) class Solution: def isSameAfterReversals(self, num: int) -> bool: answer = False reverse_num_01 = int(str..
코딩 1일 1문제! 설날인 오늘! 오늘의 문제는 leetCode의 2057번 Smallest Index With Equal Value 입니다. Smallest Index With Equal Value - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 문제 풀이 숫자가 담겨져있는 nums 리스트를 입력으로 받으면 nums의 숫자들 중에 ( 인덱스 % 10 == nums 의 해당 인덱스 번째 숫자 ) 를 만족하는 수 들 중 가장 먼저 나오는 숫자의 인덱스를..
코딩 1일 1문제! 오늘의 문제는 leetCode의 Check If String Is a Prefix of Array 입니다. Check If String Is a Prefix of Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 코드 ( Solution ) class Solution: def isPrefixString(self, s: str, words: List[str]) -> bool: answer = False check_string..
코딩 1일 1문제! 오늘의 문제는 leetCode의 Sum of Digits of String After Convert 입니다. Sum of Digits of String After Convert - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 코드 ( Solution ) class Solution: def getLucky(self, s: str, k: int) -> int: alphabet_list = list(s) convert_str = [] f..
코딩 1일 1문제! 오늘의 문제는 leetCode의 Find First Palindromic String in the Array 입니다. Find First Palindromic String in the Array - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 코드 ( Solution ) class Solution: def firstPalindrome(self, words: List[str]) -> str: answer = "" palindrome_..
코딩 1일 1문제! 오늘의 문제는 leetCode의 Sequential Digits 입니다. Sequential Digits - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 코드 ( Solution ) class Solution: def sequentialDigits(self, low: int, high: int) -> List[int]: answer = [] num_string = "123456789" min_len, max_len = len(str..
코딩 1일 1문제! 오늘의 문제는 leetCode의 Capitalize the Title 입니다. Capitalize the Title - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 코드 ( Solution ) class Solution: def capitalizeTitle(self, title: str) -> str: answer = [] lower_title = title.lower() lower_title_list = lower_title.sp..
코딩 1일 1문제! 오늘의 문제는 leetCode의 Maximum Number of Words Found in Sentences 입니다. Maximum Number of Words Found in Sentences - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 👨🏻💻 코드 ( Solution ) class Solution: def mostWordsFound(self, sentences: List[str]) -> int: length_list = [len(s..
You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. Example 1: Input: s = "abcd", t = "abcde" Output: "e" Explanation: 'e' is the letter that was added. Example 2: Input: s = "", t = "y" Output: "y" Example 3: Input: s = "a", t = "aa" Output: "a" Example 4: Input: s = "ae",..
A peak element is an element that is strictly greater than its neighbors. Given an integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks. You may imagine that nums[-1] = nums[n] = -∞. Example 1: Input: nums = [1,2,3,1] Output: 2 Explanation: 3 is a peak element and your function should return the index number 2. ..
You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane. Example 1: Input: coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]] Output: true Example 2: Input: coordinates = [[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]] Output: false Constraints: 2
Every non-negative integer N has a binary representation. For example, 5 can be represented as "101" in binary, 11 as "1011" in binary, and so on. Note that except for N = 0, there are no leading zeroes in any binary representation. The complement of a binary representation is the number in binary you get when changing every 1 to a 0 and 0 to a 1. For example, the complement of "101" in binary i..
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity. Example 1: Input: 1->2->3->4->5->NULL Output: 1->3->5->2->4->NULL Example 2: Input: 2->1->3->5->6->4->7->NULL Outpu..
Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 arr[i + 1] > ... > arr[arr.length - 1] Example 1: Input: arr = [2,1] Output: false Example 2: Input: arr = [3,5,5] Output: false ..
Given an integer n and an integer start. Define an array nums where nums[i] = start + 2*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. Example 1: Input: n = 5, start = 0 Output: 8 Explanation: Array nums is equal to [0, 2, 4, 6, 8] where (0 ^ 2 ^ 4 ^ 6 ^ 8) = 8. Where "^" corresponds to bitwise XOR operator. Example 2: Input: n = 4, start = 3 Output: 8 Explan..
Given a positive integer num, output its complement number. The complement strategy is to flip the bits of its binary representation. Example 1: Input: num = 5 Output: 2 Explanation: The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2. Example 2: Input: num = 1 Output: 0 Explanation: The binary representation of 1 is 1 (no leading zero..
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create. You can return the output in any order. Example 1: Input: S = "a1b2" Output: ["a1b2","a1B2","A1b2","A1B2"] Example 2: Input: S = "3z4" Output: ["3z4","3Z4"] Example 3: Input: S = "12345" Output: ["12345"] Example 4: Input: S = ..
Given a positive integer num, write a function which returns True if num is a perfect square else False. Follow up: Do not use any built-in library function such as sqrt. Example 1: Input: num = 16 Output: true Example 2: Input: num = 14 Output: false Constraints: 1
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on. For convenience, the full table for the 26 letters of the English alphabet is given below: [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...
Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasing order. Return the sorted array. Example 1: Input: nums = [1,1,2,2,2,3] Output: [3,1,1,2,2,2] Explanation: '3' has a frequency of 1, '1' has a frequency of 2, and '2' has a frequency of 3. Example 2: Input: nums = [2,3,1,3,2]..