
LeetCode
文章平均质量分 65
kuai-
这个作者很懒,什么都没留下…
展开
-
VS2010C++ODBC连接SQL Server
一、配置ODBC数据源1、搜索框搜索’ODBC’2、点击“添加”3、选择 “SQL Sever Native Client 11.0”4、输入数据源(需记住)的名称,以及服务器名(本人填写的是’.’,本地服务器)。5、输入登录名和密码。(如果之前用的是Windows登录,请修改为SQL Sever身份验证)。修改过程参考修改为SQL Sever身份验证登录6、选择数据库7、8、点击测试数据源9、测试成功二、连接数据库VS环境下创建工程,添加文件,先输入以下代码,然后其原创 2020-11-10 16:27:33 · 1289 阅读 · 1 评论 -
LeetCode BST专题
LeetCode连接:BST0 BST核心内容0.二叉树的核心内容 +1.基本性质:左子树都小于根,右子树都大于根。2.重要性质:BST的中序遍历序列递增有序1 二叉搜索树的定义典例 验证BST树题目:给出一个二叉树,验证其是否是BST。思路:方法一:利用BST的“重要性质”:BST的中序遍历序列递增有序。中序遍历此二叉树,判断是否递增有序。vector<int> vec; void inOrder(TreeNode* root){ if(root =原创 2021-04-11 21:33:21 · 169 阅读 · 0 评论 -
LeetCode二叉树专题
LeetCode链接:二叉树1 树的遍历1.1 树的前中后序遍历略1.2 树的层序遍历思想:BFS,典例:Input: root = [3,9,20,null,null,15,7]Output: [[3],[9,20],[15,7]]关键点:普通的 BFS 按照层序输出即可,如何按照不同的层次将其放入不同的vector 中?思路: 在普通的层序遍历中,我们出队一个元素,然后将其子结点入队,如果要按照层次分开,那么还需要加入一个 level 域用来标记节点的层次。现有一种方法: 我们原创 2021-04-10 18:13:31 · 145 阅读 · 0 评论 -
LeetCode95. Unique Binary Search Trees II
Unique Binary Search Trees IIGiven an integer n, return all the structurally unique BST’s (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the answer in any order.Example 1:Input: n = 3Output: [[1,null,2,null,3],.原创 2021-04-08 21:50:56 · 82 阅读 · 0 评论 -
LeetCode96.Unique Binary Search Trees
LeetCode 96.Unique Binary Search TreesGiven an integer n, return the number of structurally unique BST’s (binary search trees) which has exactly n nodes of unique values from 1 to n.Example 1:Input: n = 3Output: 5题意:给出数字 n,求 1-n 能组成多少个不同的 BST?思路: BS原创 2021-04-08 21:46:43 · 140 阅读 · 0 评论