{"trustable":true,"prependHtml":"\u003cstyle\u003e.statText pre { font-size: 12px; }\ntable {display:block !important; width:100%; }\ntable tbody {display:block !important; width:100%; }\ntable tbody tr { width:100% !important;display: block;}\ntable tbody tr td.statText { margin-left: 5px; display: inline-block; width: fit-content; }\ntable tbody tr td.statText br { display: block; content: \" \";line-height: 12px;margin: 12px 0;}\ntable tbody tr td.statText table table pre {\n white-space: pre-wrap;\n text-overflow: ellipsis;\n word-break: break-all;\n}\ntd { padding: 0 !important; border: none !important; }\npre { line-height: normal; margin: 0; }\n\u003c/style\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\n \n \t\t\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u003ch3\u003eProblem Statement\u003c/h3\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eDeer Only has recently shed his antlers.\nHe is now ashamed and wants to make fake ones until the real ones grow back.\n\u003cbr\u003eDeer Only has found a tree with N vertices.\nThe vertices are numbered 0 through N-1.\nYou are given two int[]s \u003cb\u003ea\u003c/b\u003e and \u003cb\u003eb\u003c/b\u003e that contain N-1 integers each.\nThese arrays describe the edges of the tree:\nfor each i, the vertices \u003cb\u003ea\u003c/b\u003e[i] and \u003cb\u003eb\u003c/b\u003e[i] are connected by an edge.\n\u003cbr\u003eDeer Only has decided to make his new antlers out of this tree.\nThe only operation he is able to do is to remove some edges from his tree, producing several smaller trees.\nThen, he wants to take two of the newly created trees and attach them to his head.\nThe two antlers must be isomorphic, otherwise he will be unbalanced when running.\n(See Notes for a formal definition of tree isomorphism.)\n\u003cbr\u003eReturn the maximal size of the deer\u0027s new fake antlers.\nThe size of an antler is defined as the number of vertices in it.\nNote that the largest possible antlers may sometimes consist only of a single vertex (and no edges).\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u003ch3\u003eDefinition\u003c/h3\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003eClass:\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eDeerInZooDivOne\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003eMethod:\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003egetmax\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003eParameters:\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eint[], int[]\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003eReturns:\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eint\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003eMethod signature:\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eint getmax(int[] a, int[] b)\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e(be sure your method is public)\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u003ch3\u003eNotes\u003c/h3\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" valign\u003d\"top\" class\u003d\"statText\"\u003e-\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eTwo trees T1 \u003d (V1, E1) and T2 \u003d (V2, E2) are called isomorphic if there exists a bijection f from V1 to V2 with the following property: For each pair of vertices in V1 (a, b), there is an edge between a and b in T1 if and only if there is an edge between f(a) and f(b) in T2.\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u003ch3\u003eConstraints\u003c/h3\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" valign\u003d\"top\" class\u003d\"statText\"\u003e-\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eN will be between 2 and 51, inclusive.\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" valign\u003d\"top\" class\u003d\"statText\"\u003e-\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003cb\u003ea\u003c/b\u003e and \u003cb\u003eb\u003c/b\u003e will contain exactly N-1 elements each.\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" valign\u003d\"top\" class\u003d\"statText\"\u003e-\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eEach element of \u003cb\u003ea\u003c/b\u003e and \u003cb\u003eb\u003c/b\u003e will be between 0 and N-1, inclusive.\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" valign\u003d\"top\" class\u003d\"statText\"\u003e-\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003eThe edges described by \u003cb\u003ea\u003c/b\u003e and \u003cb\u003eb\u003c/b\u003e will form a tree.\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u0026nbsp;\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u003ch3\u003eExamples\u003c/h3\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" nowrap\u003d\"true\" class\u003d\"statText\"\u003e0)\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{0, 1, 2}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{1, 2, 3}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003eReturns: 2\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003eThe tree looks as follows: 0-1-2-3. Deer Only can remove the edge between the vertex 1 and the vertex 2, and he gets two new trees 0-1 and 2-3. These two trees are isomorphic, so he can use these two trees as antlers.\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" nowrap\u003d\"true\" class\u003d\"statText\"\u003e1)\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{1, 8, 1, 7, 4, 2, 5, 2}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{5, 3, 6, 8, 2, 6, 8, 0}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003eReturns: 4\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003eThe two new trees will contain vertices 0,2,4,6 and 5,8,7,3.\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" nowrap\u003d\"true\" class\u003d\"statText\"\u003e2)\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{0}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{1}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003eReturns: 1\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" nowrap\u003d\"true\" class\u003d\"statText\"\u003e3)\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{0, 11, 10, 10, 19, 17, 6, 17, 19, 10, 10, 11, 9, 9, 14, 2, 13, 11, 6}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{7, 5, 2, 12, 8, 9, 16, 8, 4, 18, 8, 13, 15, 13, 17, 16, 3, 1, 7}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003eReturns: 8\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align\u003d\"center\" nowrap\u003d\"true\" class\u003d\"statText\"\u003e4)\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/td\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{14, 13, 28, 15, 20, 4, 9, 6, 1, 23, 19, 25, 25, 8, 14, 16, 2, 8, 15, 25, 22, 22, 28, 10, 10, 14, 24, 27, 8}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003e{21, 5, 12, 13, 27, 1, 24, 17, 27, 17, 23, 14, 18, 26, 7, 26, 11, 0, 25, 23, 3, 29, 22, 11, 22, 29, 15, 28, 29}\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003cpre\u003eReturns: 11\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd class\u003d\"statText\"\u003e\u003ctable\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd colspan\u003d\"2\" class\u003d\"statText\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/tbody\u003e\u003c/table\u003e\u003chr\u003e\u003cp\u003eThis problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved. \u003c/p\u003e\n \n "}}]}