[LeetCode] 2780. Minimum Index of a Valid Split (Python)
·
알고리즘/LeetCode
난이도: MediumProblem DescriptionAn element x of an integer array arr of length m is dominant if more than half the elements of arr have a value of x. You are given a 0-indexed integer array nums of length n with one dominant element. You can split nums at an index i into two arrays nums[0, ..., i] and nums[i + 1, ..., n - 1], but the split is only valid if:0 nums[0, ..., i], and nums[i + 1, ..., n..
[LeetCode] 1400. Construct K Palindrome Strings (Python)
·
알고리즘/LeetCode
난이도: Medium 문제 설명Given a string s and an integer k, return true if you can use all the characters in s to construct k palindrome strings or false otherwise. 문제 예제Example 1:Input: s = "annabelle", k = 2Output: trueExplanation: You can construct two palindromes using all characters in s.Some possible constructions "anna" + "elble", "anbna" + "elle", "anellena" + "b"Example 2:Input: s = "leetcode",..
[LeetCode] 916. Word Subsets (Python)
·
알고리즘/LeetCode
난이도: Medium 문제 설명You are given two string arrays words1 and words2.A string b is a subset of string a if every letter in b occurs in a including multiplicity.For example, "wrr" is a subset of "warrior" but is not a subset of "world".A string a from words1 is universal if for every string b in words2, b is a subset of a.Return an array of all the universal strings in words1. You may return the an..