Showing 3 questions
Determine if a number is a 'happy number'. A happy number eventually reaches 1 when replaced by the sum of the squares of its digits, repeating the process until it does.
#1. Happy Number
Given a tree, find the maximum possible sum of node values you can obtain by selecting nodes such that no two selected nodes are directly connected by an edge.
#2. Find the Maximum Sum of Node Values
Given a tree where each node has a color, find the largest subtree where all nodes have the same color. Return the number of nodes in that subtree.
#3. Maximum Subtree of the Same Color