Coding Exercise Posts - page 22 of 43

Recent posts

Symmetric Binary Tree

less than 1 minute read

Given the root to a binary tree root, return whether it is symmetric.

Swappable Trees

less than 1 minute read

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.

Swap Consecutive Index Pairs

less than 1 minute read

Given a list of integers nums, swap each consecutive even indexes with each other, and swap each consecutive odd indexes with each other.

Swap Characters to Equalize Strings

less than 1 minute read

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...

Sum Tree

less than 1 minute read

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...

Sum of Two Numbers

1 minute read

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.

Sum of Two Numbers with Sorted List

1 minute read

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...

Sum of Two Numbers Less Than Target

less than 1 minute read

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...

Sum of Two Numbers in BSTs

1 minute read

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...

Sum of Three Numbers

less than 1 minute read

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.

Sum of the Digits

less than 1 minute read

Given a positive integer num, return the sum of its digits.