Add build scripts for C# and

unify the coding style.
This commit is contained in:
krahets
2023-02-08 22:18:02 +08:00
parent 38751cc5f5
commit 6dc21691ed
63 changed files with 2703 additions and 3911 deletions
+2 -28
View File
@@ -68,20 +68,7 @@ comments: true
=== "C#"
```csharp title="linear_search.cs"
/* 线性查找(数组) */
int linearSearchArray(int[] nums, int target)
{
// 遍历数组
for (int i = 0; i < nums.Length; i++)
{
// 找到目标元素,返回其索引
if (nums[i] == target)
return i;
}
// 未找到目标元素,返回 -1
return -1;
}
[class]{linear_search}-[func]{linearSearchArray}
```
=== "Swift"
@@ -155,20 +142,7 @@ comments: true
=== "C#"
```csharp title="linear_search.cs"
/* 线性查找(链表) */
ListNode? linearSearchLinkedList(ListNode head, int target)
{
// 遍历链表
while (head != null)
{
// 找到目标结点,返回之
if (head.val == target)
return head;
head = head.next;
}
// 未找到目标结点,返回 null
return null;
}
[class]{linear_search}-[func]{linearSearchLinkedList}
```
=== "Swift"