摘要:
一、定义:RTTI:Run Time Type Identification ,运行时类型识别:指程序能够使用基类的指针或引用来检索其所指对象的实际派生类型。二、使用方式:C++中有两个操作符提供RTTI:(1)typeid 操作符:返回指针或引用所指对象的实际类型。(2)dynamic_cast ... 阅读全文
摘要:
Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre... 阅读全文
摘要:
Rectangle AreaFind the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right co... 阅读全文
摘要:
Rotate ImageYou are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?分析:rota... 阅读全文
摘要:
House RobberYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint... 阅读全文
摘要:
Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tot... 阅读全文
摘要:
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.分析: 我们知道,BS... 阅读全文