본문 바로가기

leetcode17

967. Numbers With Same Consecutive Differences 967. Numbers With Same Consecutive Differences Medium Given two integers n and k, return an array of all the integers of length n where the difference between every two consecutive digits is k. You may return the answer in any order. Note that the integers should not have leading zeros. Integers as 02 and 043 are not allowed. Example 1: Input: n = 3, k = 7 Output: [181,292,707,818,929] Explanati.. 2022. 11. 26.
49. Group Anagrams 49. Group Anagrams Medium Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Example 1: Input: strs = ["eat","tea","tan","ate","nat","bat"] Output: [["bat"],["nat","tan"],["ate","eat","tea"]] Const.. 2022. 11. 26.
39. Combination Sum 39. Combination Sum Medium Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order. The same number may be chosen from candidates an unlimited number of times. Two combinations are unique if the frequency of at least one of the chosen num.. 2022. 11. 24.
LeetCode - Weekly Contest 296 풀이 및 후기 2293. Min Max Game 난이도: Easy You are given a 0-indexed integer array nums whose length is a power of 2. Apply the following algorithm on nums: Let n be the length of nums. If n == 1, end the process. Otherwise, create a new 0-indexed integer array newNums of length n / 2. For every even index i where 0 2022. 6. 5.
51. N-Queens - 데일리 문제 51. N-Queens 난이도: Hard The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. You may return the answer in any order. Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a queen and an empty space.. 2022. 6. 5.
304. Range Sum Query 2D - Immutable - 데일리 문제 304. Range Sum Query 2D - Immutable 난이도: Medium Given a 2D matrix matrix, handle multiple queries of the following type: Calculate the sum of the elements of matrix inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). Implement the NumMatrix class: NumMatrix(int[][] matrix) Initializes the object with the integer matrix matrix. int sumRegion(int.. 2022. 6. 3.
1461. Check If a String Contains All Binary Codes of Size K 문제 풀이 1461. Check If a String Contains All Binary Codes of Size K 난이도: Medium Given a binary string s and an integer k, return true if every binary code of length k is a substring of s. Otherwise, return false. Example 1: Input: s = "00110110", k = 2 Output: true Explanation: The binary codes of length 2 are "00", "01", "10" and "11". They can be all found as substrings at indices 0, 1, 3 and 2 respec.. 2022. 5. 31.
LeetCode - Biweekly Contest 79 LeetCode - Biweekly Contest 79 2283. Check if Number Has Equal Digit Count and Digit Value 난이도 : Easy You are given a 0-indexed string num of length n consisting of digits. Return true if for every index i in the range 0 2022. 5. 29.