摘要:
题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.题解:之前做过一道是从sorted array转换到BinarySearc... 阅读全文
摘要:
题目: Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return... 阅读全文
摘要:
下面应用转自Wikipedia(http://zh.wikipedia.org/wiki/%E5%8D%A1%E5%A1%94%E5%85%B0%E6%95%B0):组合数学中有非常多的组合结构可以用卡塔兰数来计数。在Richard P. Stanley的Enumerative Combinato... 阅读全文
摘要:
题目:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique B... 阅读全文
摘要:
题目:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "ad... 阅读全文