https://leetcode.com/problems/largest-odd-number-in-string/description/
Return the largest valued odd integer that is a non-empty substring of a given string num. If no odd integer exists, return an empty string.
Return the largest valued odd integer that is a non-empty substring of a given string num. If no odd integer exists, return an empty string.
👍1
https://leetcode.com/problems/construct-string-from-binary-tree/description/
606. Construct String from Binary Tree
Given the root of a binary tree, construct a string consisting of parenthesis and integers using the preorder traversal. Omit all unnecessary empty parenthesis pairs that do not affect the one-to-one mapping relationship between the string and the original binary tree.
Example 1:
Input: root = [1,2,3,4]
Output: "1(2(4))(3)"
Explanation: Originally, it needs to be "1(2(4)())(3()())", but you need to omit all the unnecessary empty parenthesis pairs. And it will be "1(2(4))(3)"
Example 2:
Input: root = [1,2,3,null,4]
Output: "1(2()(4))(3)"
Explanation: Almost the same as the first example, except we cannot omit the first parenthesis pair to break the one-to-one mapping relationship between the input and the output.
Constraints:
- The number of nodes in the tree is in the range [1, 104].
- Node.val is between -1000 and 1000.
606. Construct String from Binary Tree
Given the root of a binary tree, construct a string consisting of parenthesis and integers using the preorder traversal. Omit all unnecessary empty parenthesis pairs that do not affect the one-to-one mapping relationship between the string and the original binary tree.
Example 1:
Input: root = [1,2,3,4]
Output: "1(2(4))(3)"
Explanation: Originally, it needs to be "1(2(4)())(3()())", but you need to omit all the unnecessary empty parenthesis pairs. And it will be "1(2(4))(3)"
Example 2:
Input: root = [1,2,3,null,4]
Output: "1(2()(4))(3)"
Explanation: Almost the same as the first example, except we cannot omit the first parenthesis pair to break the one-to-one mapping relationship between the input and the output.
Constraints:
- The number of nodes in the tree is in the range [1, 104].
- Node.val is between -1000 and 1000.
👍1
https://leetcode.com/problems/binary-tree-inorder-traversal/description/
Binary Tree Inorder Traversal - Given the root of a binary tree, return the inorder traversal of its nodes' values.
Binary Tree Inorder Traversal - Given the root of a binary tree, return the inorder traversal of its nodes' values.
👍1
https://leetcode.com/problems/element-appearing-more-than-25-in-sorted-array/description/
Most frequent element
Most frequent element
👍1
https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array/description/
Maximum Product of Two Elements in an Array
Maximum Product of Two Elements in an Array
👍1
https://leetcode.com/problems/special-positions-in-a-binary-matrix/description/
Number of single
Number of single
1
in row/col matrix👍1
https://leetcode.com/problems/difference-between-ones-and-zeros-in-row-and-column/description/
diff[i][j] = onesRowi + onesColj - zerosRowi - zerosColj
diff[i][j] = onesRowi + onesColj - zerosRowi - zerosColj
👍1
https://leetcode.com/problems/destination-city/description/
Destination city in a paths[i] = [cityAi, cityBi] path
Destination city in a paths[i] = [cityAi, cityBi] path
👍1
https://leetcode.com/problems/design-a-food-rating-system/description/
Given
Given
foods
, cuisines
and ratings
implement efficient methods changeRating(food, newRating)
and highestRated(cuisine)
👍1
https://leetcode.com/problems/maximum-product-difference-between-two-pairs/description/
max * second_max - min * second_min
max * second_max - min * second_min
👍1
https://leetcode.com/problems/buy-two-chocolates/description/
Money change after two chocolates bought
Money change after two chocolates bought
👍1
https://leetcode.com/problems/widest-vertical-area-between-two-points-containing-no-points/description/
Max x window between xy points
Max x window between xy points
👍2
https://leetcode.com/problems/maximum-score-after-splitting-a-string/description/
Max left_zeros + right_ones in 01-array
Max left_zeros + right_ones in 01-array
👍1
https://leetcode.com/problems/path-crossing/description/
Is path string of 'N', 'E', 'W', 'S' crosses
Is path string of 'N', 'E', 'W', 'S' crosses
👍1
https://leetcode.com/problems/minimum-changes-to-make-alternating-binary-string/description/
Minimum operations to make
Minimum operations to make
01
-string with no two adjacent equal👍1