We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1232309 commit 15105c8Copy full SHA for 15105c8
Binary Search Tree Iterator/Solution.rb
@@ -0,0 +1,31 @@
1
+# Definition for a binary tree node.
2
+# class TreeNode
3
+# attr_accessor :val, :left, :right
4
+# def initialize(val)
5
+# @val = val
6
+# @left, @right = nil, nil
7
+# end
8
9
+
10
+class BSTIterator
11
+ # @param {TreeNode} root
12
+ def initialize(root)
13
14
+ end
15
16
+ # @return {Boolean}
17
+ def has_next
18
19
20
21
+ # @return {Integer}
22
+ def next
23
24
25
+end
26
27
+# Your BSTIterator will be called like this:
28
+# i, v = BSTIterator.new(root), []
29
+# while i.has_next()
30
+# v << i.next
31
0 commit comments