You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[Leetcode-2269](https://leetcode.com/problems/find-the-k-beauty-of-a-number/)| Find The K Beauty Of A Number |[c++](./leetcode/2269.find-the-k-beauty-of-a-number.cpp), [python3](./leetcode/2269.find-the-k-beauty-of-a-number.py)| Math | O\(N\)| O\(N\)| - |
118
119
|[Leetcode-2698](https://leetcode.com/problems/find-the-punishment-number-of-an-integer/)| Find The Punishment Number Of An Integer |[c++](./leetcode/2698.find-the-punishment-number-of-an-integer.cpp), [python3](./leetcode/2698.find-the-punishment-number-of-an-integer.py)| Math | O\(N \* 2^K\)| O\(K\)| - |
|[Leetcode-863](https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree/)| All Nodes Distance K In Binary Tree |[c++](./leetcode/863.all-nodes-distance-k-in-binary-tree.cpp), [python3](./leetcode/863.all-nodes-distance-k-in-binary-tree.py)| Depth-First Search | O\(N\)| O\(N\)| - |
|[Leetcode-653](https://leetcode.com/problems/two-sum-iv-input-is-a-bst/)| Two Sum Iv Input Is A Bst |[c++](./leetcode/653.two-sum-iv-input-is-a-bst.cpp), [python3](./leetcode/653.two-sum-iv-input-is-a-bst.py)| Depth-First Search | O\(NH\)| O\(H\)| - |
|[Leetcode-2375](https://leetcode.com/problems/construct-smallest-number-from-di-string/)| Construct Smallest Number From Di String |[c++](./leetcode/2375.construct-smallest-number-from-di-string.cpp), [python3](./leetcode/2375.construct-smallest-number-from-di-string.py)| Backtracking | O\(N\)| O\(N\)| - |
997
1000
|[Leetcode-1718](https://leetcode.com/problems/construct-the-lexicographically-largest-valid-sequence/)| Construct The Lexicographically Largest Valid Sequence |[c++](./leetcode/1718.construct-the-lexicographically-largest-valid-sequence.cpp), [python3](./leetcode/1718.construct-the-lexicographically-largest-valid-sequence.py)| Backtracking | O\(N\!\)| O\(N\)| - |
|[Leetcode-2698](https://leetcode.com/problems/find-the-punishment-number-of-an-integer/)| Find The Punishment Number Of An Integer |[c++](./leetcode/2698.find-the-punishment-number-of-an-integer.cpp), [python3](./leetcode/2698.find-the-punishment-number-of-an-integer.py)| Backtracking | O\(N \* 2^K\)| O\(K\)| - |
|[Leetcode-237](https://leetcode.com/problems/delete-node-in-a-linked-list/)| Delete Node In A Linked List |[python3](./leetcode/237.delete-node-in-a-linked-list.py)| Other |\-|\-| - |
1174
1178
|[Leetcode-498](https://leetcode.com/problems/diagonal-traverse/)| Diagonal Traverse |[c++](./leetcode/498.diagonal-traverse.cpp)| Other |\-|\-| - |
1175
1179
|[Leetcode-29](https://leetcode.com/problems/divide-two-integers/)| Divide Two Integers |[c++](./leetcode/29.divide-two-integers.cpp), [python3](./leetcode/29.divide-two-integers.py)| Other |\-|\-| - |
1176
-
|[Leetcode-282](https://leetcode.com/problems/expression-add-operators/)| Expression Add Operators |[c++](./leetcode/282.expression-add-operators.cpp), [python3](./leetcode/282.expression-add-operators.py)| Other |\-|\-| - |
1177
1180
|[Leetcode-760](https://leetcode.com/problems/find-anagram-mappings/)| Find Anagram Mappings |[python3](./leetcode/760.find-anagram-mappings.py)| Other |\-|\-| - |
1178
1181
|[Leetcode-652](https://leetcode.com/problems/find-duplicate-subtrees/)| Find Duplicate Subtrees |[c++](./leetcode/652.find-duplicate-subtrees.cpp)| Other |\-|\-| - |
1179
1182
|[Leetcode-366](https://leetcode.com/problems/find-leaves-of-binary-tree/)| Find Leaves Of Binary Tree |[c++](./leetcode/366.find-leaves-of-binary-tree.cpp), [python3](./leetcode/366.find-leaves-of-binary-tree.py)| Other |\-|\-| - |
|[Leetcode-286](https://leetcode.com/problems/walls-and-gates/)| Walls And Gates |[c++](./leetcode/286.walls-and-gates.cpp), [python3](./leetcode/286.walls-and-gates.py)| Other |\-|\-| - |
1251
1254
|[Leetcode-127](https://leetcode.com/problems/word-ladder/)| Word Ladder |[c++](./leetcode/127.word-ladder.cpp), [python3](./leetcode/127.word-ladder.py)| Other |\-|\-| - |
1252
1255
|[Leetcode-6](https://leetcode.com/problems/zigzag-conversion/)| Zigzag Conversion |[python3](./leetcode/6.zigzag-conversion.py)| Other |\-|\-| - |
1253
-
|[Lintcode-652](https://www.lintcode.com/problem/factorization/)| Factorization |[c++](./lintcode/652.factorization.cpp), [python3](./lintcode/652.factorization.py)| Other |\-|\-| - |
1254
1256
|[Lintcode-390](https://www.lintcode.com/problem/find-peak-element-ii/)| Find Peak Element II |[c++](./lintcode/390.find-peak-element-ii.cpp), [python3](./lintcode/390.find-peak-element-ii.py)| Other |\-|\-| - |
1255
1257
|[Lintcode-144](https://www.lintcode.com/problem/interleaving-positive-and-negative-numbers/)| Interleaving Positive And Negative Numbers |[c++](./lintcode/144.interleaving-positive-and-negative-numbers.cpp), [python3](./lintcode/144.interleaving-positive-and-negative-numbers.py)| Other |\-|\-| - |
1256
1258
|[Lintcode-611](https://www.lintcode.com/problem/knight-shortest-path/)| Knight Shortest Path |[c++](./lintcode/611.knight-shortest-path.cpp), [python3](./lintcode/611.knight-shortest-path.py)| Other |\-|\-| - |
// Given two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If there are multiple valid strings, return any of them.
9
+
// A string s is a subsequence of string t if deleting some number of characters from t (possibly 0) results in the string s.
10
+
//
11
+
// Example 1:
12
+
//
13
+
// Input: str1 = "abac", str2 = "cab"
14
+
// Output: "cabac"
15
+
// Explanation:
16
+
// str1 = "abac" is a subsequence of "cabac" because we can delete the first "c".
17
+
// str2 = "cab" is a subsequence of "cabac" because we can delete the last "ac".
18
+
// The answer provided is the shortest such string that satisfies these properties.
19
+
//
20
+
// Example 2:
21
+
//
22
+
// Input: str1 = "aaaaaaaa", str2 = "aaaaaaaa"
23
+
// Output: "aaaaaaaa"
24
+
//
25
+
//
26
+
// Constraints:
27
+
//
28
+
// 1 <= str1.length, str2.length <= 1000
29
+
// str1 and str2 consist of lowercase English letters.
# Given two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If there are multiple valid strings, return any of them.
9
+
# A string s is a subsequence of string t if deleting some number of characters from t (possibly 0) results in the string s.
10
+
#
11
+
# Example 1:
12
+
#
13
+
# Input: str1 = "abac", str2 = "cab"
14
+
# Output: "cabac"
15
+
# Explanation:
16
+
# str1 = "abac" is a subsequence of "cabac" because we can delete the first "c".
17
+
# str2 = "cab" is a subsequence of "cabac" because we can delete the last "ac".
18
+
# The answer provided is the shortest such string that satisfies these properties.
19
+
#
20
+
# Example 2:
21
+
#
22
+
# Input: str1 = "aaaaaaaa", str2 = "aaaaaaaa"
23
+
# Output: "aaaaaaaa"
24
+
#
25
+
#
26
+
# Constraints:
27
+
#
28
+
# 1 <= str1.length, str2.length <= 1000
29
+
# str1 and str2 consist of lowercase English letters.
0 commit comments