First Round DSA Question:
Given a binary tree represented using the Node class below:
Example 1:
A
/
B C
-> "ABC"
Example 2:
A
C
/
B
-> "ACB"
class Node {
char value;
@Nullable Node left;
@Nullable Node right;
public Node(char value, @Nullable Node left, @Nullable Node right) {
this.value = value;
this.left = left;
this.right = right;
}
}
// Requirements: Provide the string representation of a binary tree represented using the above Node class.