摘要:
题目:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ... 阅读全文
摘要:
题目:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or eq... 阅读全文
摘要:
题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.说明: 1)实现与... 阅读全文
摘要:
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.说明: 1)二叉树可... 阅读全文
摘要:
auto定义变量时放在变量前,无需知道具体变量类型,系统可自行推断类型,减少编程工作,特别是在模板使用时,使用更方便。下面简单例子:1 auto a=1;2 auto b='a';3 auto s="abdc";4 auto c;//这样使用时错误的,系统无法自动推断出变量类型5 //下... 阅读全文
摘要:
题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: P... 阅读全文
摘要:
题目:Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the corre... 阅读全文