1. Add build script for Java.

2. Add height limitation for code blocks in extra.css.
3. Fix "节点" to "结点".
This commit is contained in:
krahets
2023-02-07 04:43:52 +08:00
parent b14568151c
commit ecbf2d1560
54 changed files with 457 additions and 1633 deletions

View File

@ -15,17 +15,7 @@ comments: true
=== "Java"
```java title="linear_search.java"
/* 线性查找(数组) */
int linearSearchArray(int[] nums, int target) {
// 遍历数组
for (int i = 0; i < nums.length; i++) {
// 找到目标元素,返回其索引
if (nums[i] == target)
return i;
}
// 未找到目标元素,返回 -1
return -1;
}
[class]{hashing_search}-[func]{linearSearchArray}
```
=== "C++"
@ -155,18 +145,7 @@ comments: true
=== "Java"
```java title="linear_search.java"
/* 线性查找(链表) */
ListNode linearSearchLinkedList(ListNode head, int target) {
// 遍历链表
while (head != null) {
// 找到目标结点,返回之
if (head.val == target)
return head;
head = head.next;
}
// 未找到目标结点,返回 null
return null;
}
[class]{hashing_search}-[func]{linearSearchLinkedList}
```
=== "C++"