https://leetcode.com/problems/find-the-difference/
Given two strings
sandtwheretis generated by shuffling stringsand adding one letter at a random position,
Return the letter that was added tot.
https://leetcode.com/problems/find-the-difference/
Given two strings
sandtwheretis generated by shuffling stringsand adding one letter at a random position,
Return the letter that was added tot.
https://leetcode.com/problems/ransom-note/
Given two strings
ransomNoteandmagazine,
ReturnTrueifransomNotecan be constructed using the letters frommagazine,Falseotherwise.Each letter in
magazinecan only be used once inransomNote.
https://leetcode.com/problems/longest-common-prefix/
Given an array of strings
strs.
Return the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string"".
https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/
Given two strings
needleandhaystack.
Return the index of the first occurrence ofneedleinhaystack, or-1ifneedleis not part ofhaystack.
https://leetcode.com/problems/minimum-depth-of-binary-tree/
Given the
rootof a binary tree, Return its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
https://leetcode.com/problems/binary-tree-level-order-traversal/
Given the root of a binary tree,
Return the level order traversal of its nodes' values (i.e., from left to right, level by level).
https://leetcode.com/problems/insert-into-a-binary-search-tree/
Given the root node of a binary search tree (BST) and a value to insert into the tree,
Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST.Note that there may exist multiple valid ways for the insertion, as long as the tree remains a valid BST after insertion.
https://leetcode.com/problems/same-tree/
Given the roots of two binary trees
pandq,
ReturnTrueif they are the same tree,Falseotherwise.Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.
https://leetcode.com/problems/path-sum/
Given the root of a binary tree and an integer
targetSum,
ReturnTrueif the tree has a root-to-leaf path such that the sum of the node values along the path equalstargetSum.A leaf is a node with no children.
| class TreeNode: | |
| """ | |
| A node in a Binary Search Tree. | |
| Attributes: | |
| val: The value stored in the node | |
| left: Reference to the left child node | |
| right: Reference to the right child node | |
| """ | |
| def __init__(self, val: int) -> None: |