558.quad-tree-intersection.java 828 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. // Definition for a QuadTree node.
  3. class Node {
  4. public boolean val;
  5. public boolean isLeaf;
  6. public Node topLeft;
  7. public Node topRight;
  8. public Node bottomLeft;
  9. public Node bottomRight;
  10. public Node() {}
  11. public Node(boolean _val,boolean _isLeaf,Node _topLeft,Node _topRight,Node _bottomLeft,Node _bottomRight) {
  12. val = _val;
  13. isLeaf = _isLeaf;
  14. topLeft = _topLeft;
  15. topRight = _topRight;
  16. bottomLeft = _bottomLeft;
  17. bottomRight = _bottomRight;
  18. }
  19. };
  20. */
  21. class Solution {
  22. public Node intersect(Node quadTree1, Node quadTree2) {
  23. }
  24. private Node helper(Node node1, Node node2) {
  25. if (node1.isLeaf && node2.isLeaf) {
  26. return new Node(node1.val || node2.val, true, null, null, null, null);
  27. }
  28. }
  29. }