Advertisement
Guest User

Leap Dev

a guest
Oct 13th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. # you can write to stdout for debugging purposes, e.g.
  2. # print("this is a debug message")
  3.  
  4. from extratypes import Tree  # library with types used in the task
  5.  
  6. def visableNum(T, currentMax = 0):
  7.     if T == None:
  8.         return 0
  9.     count = 0
  10.     if T.x >= currentMax:
  11.         count = 1
  12.         currentMax = T.x
  13.     return count + visableNum(T.l, currentMax) + visableNum(T.r, currentMax)
  14.  
  15. def solution(T):
  16.     # write your code in Python 3.6
  17.     return visableNum(T)
  18.     pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement