摘要:
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题意:将已排序的数组转成高度平衡的搜索二叉树。 思路:这题和Convert sorted list to 阅读全文
摘要:
Say you have an array for which the i th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may compl 阅读全文
摘要:
Say you have an array for which the i th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may compl 阅读全文
摘要:
Say you have an array for which the i th element is the price of a given stock on day i. If you were only permitted to complete at most one transactio 阅读全文
摘要:
Given a 2D board containing'X'and'O', capture all regions surrounded by'X'. A region is captured by flipping all'O's into'X's in that surrounded regio 阅读全文
摘要:
本文为对《C++ primer (中文版第五版)》中有关关联容器的讲解和网上大神们的博客整理而成。 关联容器和顺序容器的根本不同在于:关联容器中的元素是按关键字来保存和访问的,而顺序容器中的元素则是按它们在容器中的位置来顺序保存和访问的。顺序容器有vector、deque、list、forward_ 阅读全文