mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-19 07:17:54 +08:00
fix(csharp): reformat csharp codes and docs (#652)
* fix(csharp): reformat the C# codes and docs * Update time_complexity.md --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@@ -111,8 +111,7 @@
|
||||
|
||||
```csharp title=""
|
||||
/* 链表节点类 */
|
||||
class ListNode
|
||||
{
|
||||
class ListNode {
|
||||
int val; // 节点值
|
||||
ListNode next; // 指向下一节点的引用
|
||||
ListNode(int x) => val = x; //构造函数
|
||||
|
||||
@@ -539,15 +539,13 @@
|
||||
```csharp title="list.cs"
|
||||
/* 通过索引遍历列表 */
|
||||
int count = 0;
|
||||
for (int i = 0; i < list.Count(); i++)
|
||||
{
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
count++;
|
||||
}
|
||||
|
||||
/* 直接遍历列表元素 */
|
||||
count = 0;
|
||||
foreach (int n in list)
|
||||
{
|
||||
foreach (int n in list) {
|
||||
count++;
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user