Skip to content

Commit 839cee4

Browse files
committed
目录 日志更新
1 parent 4368fbf commit 839cee4

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
- [SQL 优化](https://github.com/crossoverJie/Java-Interview/blob/master/MD/SQL-optimization.md)
3636
- [数据库水平垂直拆分](https://github.com/crossoverJie/Java-Interview/blob/master/MD/DB-split.md)
3737

38+
### 数据结构与算法
39+
- [红包算法](https://github.com/crossoverJie/Java-Interview/blob/master/src/main/java/com/crossoverjie/red/RedPacket.java)
40+
- [二叉树中序遍历](https://github.com/crossoverJie/Java-Interview/blob/master/src/main/java/com/crossoverjie/algorithm/BinaryNode.java#L76-L101)
41+
- 是否为快乐数字
3842

3943
### 附加技能
4044

src/main/java/com/crossoverjie/algorithm/BinaryNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public String toString() {
7474

7575

7676
/**
77-
* 二叉树的层序遍历 借助于队列来实现
77+
* 二叉树的层序遍历 借助于队列来实现 借助队列的先进先出的特性
7878
*
7979
* 首先将根节点入队列 然后遍历队列。
8080
* 首先将根节点打印出来,接着判断左节点是否为空 不为空则加入队列

src/main/java/com/crossoverjie/algorithm/HappyNum.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,36 @@
55

66
/**
77
* Function: 判断一个数字是否为快乐数字 19 就是快乐数字 11就不是快乐数字
8+
* 19
9+
* 1*1+9*9=82
10+
* 8*8+2*2=68
11+
* 6*6+8*8=100
12+
* 1*1+0*0+0*0=1
813
*
14+
* 11
15+
* 1*1+1*1=2
16+
* 2*2=4
17+
* 4*4=16
18+
* 1*1+6*6=37
19+
* 3*3+7*7=58
20+
* 5*5+8*8=89
21+
* 8*8+9*9=145
22+
* 1*1+4*4+5*5=42
23+
* 4*4+2*2=20
24+
* 2*2+0*0=2
25+
*
26+
* 这里结果 1*1+1*1=2 和 2*2+0*0=2 重复,所以不是快乐数字
927
* @author crossoverJie
1028
* Date: 04/01/2018 14:12
1129
* @since JDK 1.8
1230
*/
1331
public class HappyNum {
1432

33+
/**
34+
* 判断一个数字是否为快乐数字
35+
* @param number
36+
* @return
37+
*/
1538
public boolean isHappy(int number) {
1639
Set<Integer> set = new HashSet<>(30);
1740
while (number != 1) {

0 commit comments

Comments
 (0)