Create an implementation of a Trie structure.
Given an array nums
and a number k
, return true if there are two distinct indices i
and j
in the array such that nums[i] == nums[j]
and abs(i - j) <= k
.
Given a perfect binary tree, count the number of nodes with an algorithm that has less than O(n)
time complexity.
Given a binary tree, write an iterator that performs in-order iteration and returns next
as well as hasNext
. It is guaranteed that next
is never called on an empty tree.