mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-04 06:07:20 +08:00 
			
		
		
		
	Fix code formats.
This commit is contained in:
		@ -440,7 +440,7 @@ $$
 | 
				
			|||||||
=== "JavaScript"
 | 
					=== "JavaScript"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ```javascript title=""
 | 
					    ```javascript title=""
 | 
				
			||||||
    function algorithm(n){
 | 
					    function algorithm(n) {
 | 
				
			||||||
        var a = 1; // +1
 | 
					        var a = 1; // +1
 | 
				
			||||||
        a += 1; // +1
 | 
					        a += 1; // +1
 | 
				
			||||||
        a *= 2; // +1
 | 
					        a *= 2; // +1
 | 
				
			||||||
@ -448,7 +448,6 @@ $$
 | 
				
			|||||||
        for(let i = 0; i < n; i++){ // +1(每轮都执行 i ++)
 | 
					        for(let i = 0; i < n; i++){ // +1(每轮都执行 i ++)
 | 
				
			||||||
            console.log(0); // +1
 | 
					            console.log(0); // +1
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ```
 | 
					    ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -463,7 +462,6 @@ $$
 | 
				
			|||||||
        for(let i = 0; i < n; i++){ // +1(每轮都执行 i ++)
 | 
					        for(let i = 0; i < n; i++){ // +1(每轮都执行 i ++)
 | 
				
			||||||
            console.log(0); // +1
 | 
					            console.log(0); // +1
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ```
 | 
					    ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -484,12 +482,14 @@ $$
 | 
				
			|||||||
=== "C#"
 | 
					=== "C#"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ```csharp title=""
 | 
					    ```csharp title=""
 | 
				
			||||||
    void algorithm(int n) {
 | 
					    void algorithm(int n)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        int a = 1;  // +1
 | 
					        int a = 1;  // +1
 | 
				
			||||||
        a = a + 1;  // +1
 | 
					        a = a + 1;  // +1
 | 
				
			||||||
        a = a * 2;  // +1
 | 
					        a = a * 2;  // +1
 | 
				
			||||||
        // 循环 n 次
 | 
					        // 循环 n 次
 | 
				
			||||||
        for (int i = 0; i < n; i++) { // +1(每轮都执行 i ++)
 | 
					        for (int i = 0; i < n; i++) // +1(每轮都执行 i ++)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            Console.WriteLine(0);   // +1
 | 
					            Console.WriteLine(0);   // +1
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -348,15 +348,18 @@
 | 
				
			|||||||
    ```csharp title="hash_map.cs"
 | 
					    ```csharp title="hash_map.cs"
 | 
				
			||||||
    /* 遍历哈希表 */
 | 
					    /* 遍历哈希表 */
 | 
				
			||||||
    // 遍历键值对 Key->Value
 | 
					    // 遍历键值对 Key->Value
 | 
				
			||||||
    foreach (var kv in map) {
 | 
					    foreach (var kv in map)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        Console.WriteLine(kv.Key + " -> " + kv.Value);
 | 
					        Console.WriteLine(kv.Key + " -> " + kv.Value);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // 单独遍历键 key
 | 
					    // 单独遍历键 key
 | 
				
			||||||
    foreach (int key in map.Keys) {
 | 
					    foreach (int key in map.Keys)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        Console.WriteLine(key);
 | 
					        Console.WriteLine(key);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // 单独遍历值 value
 | 
					    // 单独遍历值 value
 | 
				
			||||||
    foreach (String val in map.Values) {
 | 
					    foreach (String val in map.Values)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
        Console.WriteLine(val);
 | 
					        Console.WriteLine(val);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ```
 | 
					    ```
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user