TinaCristal's Blog


  • Home

  • Tags

  • Categories

  • Archives

  • Search

L1-两数之和

Posted on 2018-05-14 | In LintCode

给一个整数数组,找到两个数使得他们的和等于一个给定的数 target。

你需要实现的函数twoSum需要返回这两个数的下标, 并且第一个下标小于第二个下标。注意这里下标的范围是 0 到 n-1。

Read more »

语法错误,将“Dimensions”插入到完整ReferenceType

Posted on 2018-05-13 | In java

当我们希望定义一个不包括重复整数的集时,如果使用如下代码
Set set = new HashSet();//错误
编译器会报错

Read more »

L1-比较字符串

Posted on 2018-05-13 | In LintCode

比较两个字符串A和B,确定A中是否包含B中所有的字符。字符串A和B中的字符都是 大写字母

样例

给出 A = “ABCD” B = “ACD”,返回 true

给出 A = “ABCD” B = “AABC”, 返回 false

法一

比较B字符串在A中出现的次数

Read more »

html学习笔记(一)

Posted on 2018-05-13 | In web

html 决定页面放什么东西

HTML 图像

使用 标签定义 HTML 页面中的图像。 标签有两个必需的属性:src 和 alt。

Read more »

周总结(2)

Posted on 2018-05-13 | In 周总结

生活

  • 这周起床起得越来越晚了,尴尬…说好要早起晨跑,事实上也就坚持了三天,看来行动力还是不够

  • 一天到晚也不知道胡思乱想啥,有些事必须心无旁骛地去做。没有时间允许你停下脚步。

    Read more »

hexo博客重装系统还原

Posted on 2018-05-12 | In 环境安装配置

重装系统前备份是个好习惯⊙﹏⊙

更新前备份
备份好 hexo 目录下的_config.yml,theme/,source/,scaffolds/,package.json,.gitignore,node_modules(当然如果你硬盘空间够大,备份整个 hexo 文件夹也可以)。然后把 hexo 目录里面的东西全部删掉。

备份用户目录下的文件:开始,你的 windows 用户名,打开你的用户文件夹后备份.ssh文件夹和.gitconfig、_netrc以及_viminfo这三个文件。

Read more »

ubuntu下配置shadowsocks

Posted on 2018-05-12

前言

Shadowsocks无GUI客户端教程:Linux安装配置Shadowsocks客户端及开机自动启动
Shadowsocks-Qt5客户端教程:Shadowsocks-Qt5 For Centos 7
Shadowsocks服务端教程:搬瓦工Shadowsocks安装及配置多用户(服务端)
(https://blog.huihut.com/2017/08/25/LinuxInstallConfigShadowsocksClient/)

Read more »

the difference between s == null and s.length == 0, where s is a String?

Posted on 2018-05-12

NULL means that memory has not been allocated to the pointer (string). So there is no representation of the string in memory.

On the other hand, a string can be initialised as “” (empty string). This does mean that memory is allocated, and it is present in memory, it’s just empty. That means its length is 0.

Read more »

L1-翻转字符串

Posted on 2018-05-12 | In LintCode

题目
给定一个字符串,逐个翻转字符串中的每个单词。

说明
单词的构成:无空格字母构成一个单词
输入字符串是否包括前导或者尾随空格?可以包括,但是反转后的字符不能包括
如何处理两个单词间的多个空格?在反转字符串中间空格减少到只含一个

样例
给出s = “the sky is blue”,返回“blue is sky the”

Read more »

L1-Majority Element

Posted on 2018-05-11 | In LintCode

Majority Element

描述
给定一个整型数组,找出主元素,它在数组中的出现次数严格大于数组元素个数的二分之一。

样例
给出数组[1,1,1,1,2,2,2],返回 1

挑战
要求时间复杂度为O(n),空间复杂度为O(1)

Read more »

1…404142…45

TinaCristal

443 posts
57 categories
55 tags
GitHub E-Mail
© 2020 TinaCristal
Powered by Hexo
|
Theme — NexT.Mist v5.1.4