تم الحل ✓
categoryهندسة الحاسبات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Write a method that receives the root of a binary tree and finds the count of all subtrees having
the same value in all of its nodes.
For example: if the method receives the root of the following tree:
A
It will return 7 because the following subtrees have the same value in all of its nodes:
Note: binary tree is constructed of nodes which are instances of the following class:
class Binary TreeNode
{
int data;
Binary TreeNode leftchild = null;
Binary TreeNode rightchild = null;
Binary TreeNode(int data) {
this.data = data;
}
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.