摘要:
QuestionGiven an Iterator class interface with methods:next()andhasNext(), design and implement a PeekingIterator that support thepeek()operation -- i... 阅读全文
摘要:
QuestionImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return ... 阅读全文
摘要:
QuetionInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Solution 1 -- RecursionEasy to t... 阅读全文
摘要:
QuestionDesign a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() --... 阅读全文
摘要:
QuestionGivennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after ra... 阅读全文
摘要:
QuestionThere areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the followi... 阅读全文
摘要:
QuestionGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents you... 阅读全文