202002-22 [LeetCode每日一题]105. Construct Binary Tree from Preorder and Inorder Traversal 题目如下: Given preorder and inorder traversal of a tree, construct the binary tree. eg: preorder = [3,9,20,15,7] inorder = [9,3,15,20,7] re.... Read More >
202002-21 [LeetCode每日一题]101. Symmetric Tree 题目如下: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] i.... Read More >
202002-20 [LeetCode每日一题]100. Same Tree 题目如下: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurall.... Read More >
202002-19 [LeetCode每日一题]99. Recover Binary Search Tree 题目如下: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. LeetCode-99 Recover Binary.... Read More >
201907-31 http协议下域名访问网站失败的解决方法 安装firewallD更换SSH端口后,发现使用http协议+www域名访问网站失败,而不带www的域名和ip:80直接访问都可以访问。 开始时认为是DNS解析的问题,一顿操作之后,发现没什么用。。。。 后来顿悟,遂去开放防火墙80端口,执行以下命令: firewall-cmd --permanent --zone=public --add-port=80/tcp 如果你的443端.... Read More >
201907-30 CentOS7安装firewalld并替换SSH默认的22端口 SSH登录验证成功后,您将看到以下消息: Last login: Mon Jul 29 23:08:52 2019 from xxx.xxx.xxx.xxx. Last failed login: Sun Jul 21 22:02:31 2019 from xxx.xxx.xxx.xxx on ssh:notty There were 15922 failed login attempts s.... Read More >
201907-13 LeetCode-1 Two Sum 解析 题目: 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: [go]给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1.... Read More >
201903-14 Go内建容器之映射(map) 映射是一种数据结构,用于存储一系列无序的键值对。 注: 1.map内部使用Hash表 2.除了slice,map,function的内建类型都可以作为map的key 3.struct类型不包含上述字段,也可作为key 创建和初始化 使用make声明map [go]m.... Read More >
201903-09 Go内建容器之切片(slice) 切片(slice)是一种数据结构,这种数据结构便于使用和管理数据集合。切片是围绕动态数组的概念构建的,可以按需自动增长和缩小。切片的动态增长是通过内置函数append来实现的,这个函数可以快速且高效地增长切片。还可以通过对切片的再次切片来缩小一个切片的大小。因为切片的底层内存也是在连续块中分配的,所.... Read More >
201903-09 Go内建容器之数组 数组的声明 [go]var arr1 [5]int arr2 := [3]int{1, 3, 5} arr3 := [...]int{2, 4, 6, 8, 10} var xy [3][4]bool //三行四列的二维数组[/go] 数组的遍历 [go]func trave.... Read More >