- 博客(4)
- 收藏
- 关注
转载 macos生成SSH key与GitHub连接
一、检查 SSH key 是否存在在终端输入:ls -al ~/.ssh如果没有,终端显示如下:No such file or directory如果已经存在,则会显示 id_rsa 和 id_rsa.pub二、生成新的 SSH key在终端输入:ssh-keygen -t rsa -C "your_email@example.com"其中 your_email@example.com 为你在 G...
2018-03-22 22:26:06 592
原创 单独的数字(线性时间复杂度,且无额外空间)
给定一个数组 A,除了一个数出现一次之外,其余数都出现三次。找出出现一次的数。如:{1, 2, 1, 2, 1, 2, 7},找出 7。难点:算法只能是线性时间的复杂度,并且不能使用额外的空间。策略:采用位运算,把每个数字的每一位都加起来,对3取余。(同理,其余数出现k次,就对k取余)本机int型变量是32位,故外层循环为32位(常数级循环),内层n重循环,因此符合线性时间复杂度。#include...
2018-03-02 18:45:46 487
原创 Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
题目:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.(给的点是用vector保存)/** * Definition for a point. * struct Point { * int x; * int y; * ...
2018-02-19 12:13:44 531
原创 二叉树层次输出带换行
1. 二叉树的层次输出(不带换行输出)思想:利用一个队列void levelPrint1(BTree *root){ //不带换行的 if(!root)return; BTree *temp; queue myque; myque.push(root); while(!myque.empty()){ temp = myque.front(); print(temp->va
2018-01-30 17:14:46 1547
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人