Skip to content

Commit

Permalink
day 02 (#2)
Browse files Browse the repository at this point in the history
* day 02

* windows seems to be unstable, removed from CI
  • Loading branch information
adaamz authored Dec 2, 2020
1 parent bb596d5 commit 9271995
Show file tree
Hide file tree
Showing 14 changed files with 1,367 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
deno: ["v1.x", "nightly"]
os: [macOS-latest, windows-latest, ubuntu-latest]
os: [macOS-latest, ubuntu-latest]

steps:
- name: Setup repo
Expand Down
14 changes: 14 additions & 0 deletions 02/@types/min_max/password_policy.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export type Quantifier = {
min: number;
max: number;
};

export type PasswordPolicy = {
letter: string;
quantifier: Quantifier;
};

export type PasswordWithPolicy = {
password: string;
policy: PasswordPolicy;
};
9 changes: 9 additions & 0 deletions 02/@types/positions/password_policy.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export type PasswordPolicy = {
letter: string;
letterPositions: number[];
};

export type PasswordWithPolicy = {
password: string;
policy: PasswordPolicy;
};
16 changes: 16 additions & 0 deletions 02/app.stdin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { readLines } from "../deps.ts";

import {fixExpenseReport2, fixExpenseReport3} from "./src/expense_report_fixer.ts";

async function readExpenses(): Promise<number[]> {
const expenses = [];

for await (const line of readLines(Deno.stdin)) {
expenses.push(Number(line));
}

return expenses;
}

console.log(fixExpenseReport2(await readExpenses()));
console.log(fixExpenseReport3(await readExpenses()));
Loading

0 comments on commit 9271995

Please sign in to comment.