- 自由转载-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 3.0
- CoCode:一个让大家学习、成长、相聚并获得乐趣的技术社区
- 编程入门指南 一群(243545867); 编程入门指南 二群(438379133)
- 答疑邮箱: [email protected] (萧井陌)
v2.0 准备重构
2015年06月07日 v1.4 更新
data Node = Node String deriving (Eq, Ord, Show) | |
data Graph = Graph (M.Map Node [Edge]) deriving (Eq, Show) | |
emptyGraph = Graph M.empty | |
nodes (Graph g) = M.keys g | |
edges (Graph g) = concat (M.elems g) | |
s2n = Node | |
n2s (Node n) = n | |
insertNode n (Graph g) = Graph (M.insert n [] g) | |
insertEdge e@(s, _, _) (Graph g) = Graph (M.adjust (e:) s g) |
#cloud-config | |
users: | |
- default | |
- name: stack | |
lock_passwd: False | |
sudo: ["ALL=(ALL) NOPASSWD:ALL\nDefaults:stack !requiretty"] | |
shell: /bin/bash | |
write_files: |
# use python3 | |
from collections import deque | |
ROMAN_ARABIC_DICT = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} | |
DIRT_DICT = {} | |
METAL_DICT = {} | |
MSG = "I have no idea what you are talking about" | |
def parse_galaxy_numerals(galaxy_numerals: list) -> int: |
# Load posh-git module from current directory | |
Import-Module posh-git | |
# Get full name of user | |
$username = [Environment]::UserName | |
$hostname = $env:COMPUTERNAME | |
# Am I an admin? | |
$wid = [System.Security.Principal.WindowsIdentity]::GetCurrent() | |
$prp = new-object System.Security.Principal.WindowsPrincipal($wid) |
# -*- coding: utf-8 -*- | |
# Please use Python 3 | |
# Please run it with python3 -m doctest xxx.py | |
def flatten(nested_list: list) -> list: | |
""" | |
>>> flatten([]) | |
[] | |
>>> flatten([[[[]],[]]]) |
# -*- coding: utf-8 -*- | |
# Please use Python 3 | |
# Please run it with python3 -m doctest xxx.py | |
import json | |
from math import sin, cos, acos, fabs, radians | |
import requests | |
#import <Foundation/Foundation.h> | |
@interface Table : NSObject | |
- (id)init:(NSString *)name | |
+ (BOOL)isExists:(NSString *)name | |
- (void)clear |
package codeTest; | |
import java.util.Collection; | |
import java.util.Iterator; | |
/** | |
* Implement an iterator that iterates all the elements of a collection of collections | |
*/ | |
public class CodeTestExerciseCollectionOfCollectionsIterator implements Iterator<Object> { |
package codeTest; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; |