Symmetric Binary Tree
Given the root to a binary tree root, return whether it is symmetric.
Given the root to a binary tree root, return whether it is symmetric.
Given two trees root0 and root1, return whether you can transform root0 into root1 by swapping any node’s left and right subtrees any number of times.
Given a list of integers nums, swap each consecutive even indexes with each other, and swap each consecutive odd indexes with each other.
You are given two lowercase alphabet strings s and t, both of them the same length. You can pick one character in s and another in t and swap them. Given you...
Given a binary tree root, return whether for every node in the tree other than the leaves, its value is equal to the sum of its left child’s value and its ri...
Given a list of numbers nums and a number k, return whether any two elements from the list add up to k. You may not use the same element twice.
Given a list of integers nums sorted in ascending order and an integer k, return whether any two elements from the list add up to k. You may not use the same...
Implement a data structure with the following methods:
Given a list of integers nums and an integer target, return the sum of the largest pair of numbers in nums whose sum is less than target. You can assume that...
You are given two binary search trees a and b and an integer target. Return whether there’s a number in a and a number in b such that their sum equals to tar...
Given a list of integers nums and an integer k, determine if there are three distinct elements in the list that add up to k.
Given a positive integer num, return the sum of its digits.