[LeetCode] 1980. Find Unique Binary String (Python)
·
알고리즘/LeetCode
난이도: Medium문제 설명Given an array of strings nums containing n unique binary strings each of length n, return a binary string of length n that does not appear in nums. If there are multiple answers, you may return any of them. 문제 예제Example 1:Input: nums = ["01","10"]Output: "11"Explanation: "11" does not appear in nums. "00" would also be correct.Example 2:Input: nums = ["00","01"]Output: "11"Expla..
[LeetCode] 1415. The k-th Lexicographical String of All Happy Strings of Length n (Python)
·
알고리즘/LeetCode
난이도: Medium문제 설명A happy string is a string that:consists only of letters of the set ['a', 'b', 'c'].s[i] != s[i + 1] for all values of i from 1 to s.length - 1 (string is 1-indexed).For example, strings "abc", "ac", "b" and "abcbabcbcb" are all happy strings and strings "aa", "baa" and "ababbc" are not happy strings. Given two integers n and k, consider a list of all happy strings of length n so..
[LeetCode] 2375. Construct Smallest Number From DI String (Python)
·
알고리즘/LeetCode
난이도: Medium문제 설명You are given a 0-indexed string pattern of length n consisting of the characters 'I' meaning increasing and 'D' meaning decreasing. A 0-indexed string num of length n + 1 is created using the following conditions:num consists of the digits '1' to '9', where each digit is used at most once.If pattern[i] == 'I', then num[i] .If pattern[i] == 'D', then num[i] > num[i + 1].Return th..
[LeetCode] 1079. Letter Tile Possibilities (Python)
·
알고리즘/LeetCode
난이도: Medium문제 설명You have n  tiles, where each tile has one letter tiles[i] printed on it. Return the number of possible non-empty sequences of letters you can make using the letters printed on those tiles. 문제 예제Example 1:Input: tiles = "AAB"Output: 8Explanation: The possible sequences are "A", "B", "AA", "AB", "BA", "AAB", "ABA", "BAA".Example 2:Input: tiles = "AAABBC"Output: 188Example 3:Input:..
[LeetCode] 1718. Construct the Lexicographically Largest Valid Sequence (Python)
·
카테고리 없음
난이도: Medium문제 설명Given an integer n, find a sequence that satisfies all of the following:The integer 1 occurs once in the sequence.Each integer between 2 and n occurs twice in the sequence.For every integer i between 2 and n, the distance between the two occurrences of i is exactly i.The distance between two numbers on the sequence, a[i] and a[j], is the absolute difference of their indices, |j -..
[LeetCode] 494. Target Sum (Python)
·
알고리즘/LeetCode
난이도: Medium 문제 설명You are given an integer array nums and an integer target.You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers.For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate them to build the expression "+2-1".Return the number of different expressions ..