Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],…] (si < ei), determine if a person could attend all meetings.
Example 1:
1 | Input: [[0,30],[5,10],[15,20]] |
Example 2:
1 | Input: [[7,10],[2,4]] |
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],…] (si < ei), determine if a person could attend all meetings.
Example 1:
1 | Input: [[0,30],[5,10],[15,20]] |
Example 2:
1 | Input: [[7,10],[2,4]] |
Given two strings s and t , write a function to determine if t is an anagram of s.
Example 1:
1 | Input: s = "anagram", t = "nagaram" |
Example 2:
1 | Input: s = "rat", t = "car" |
Note:
You may assume the string contains only lowercase alphabets.
Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].
The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.
You must write an algorithm that runs in O(n) time and without using the division operation.
Example 1:
1 | Input: nums = [1,2,3,4] |
Example 2:
1 | Input: nums = [-1,1,0,-3,3] |
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself).”
Example 1:
1 | Input: root = [6,2,8,0,4,7,9,null,null,3,5], p = 2, q = 8 |
Example 2:
1 | Input: root = [6,2,8,0,4,7,9,null,null,3,5], p = 2, q = 4 |
Example 3:
1 | Input: root = [2,1], p = 2, q = 1 |
Given the root of a binary search tree, and an integer k, return the kth (1-indexed) smallest element in the tree.
Example 1:
1 | Input: root = [3,1,4,null,2], k = 1 |
Example 2:
1 | Input: root = [5,3,6,2,4,null,null,1], k = 3 |