A 10/default.nix => 10/default.nix +15 -0
@@ 0,0 1,15 @@
+{ stdenv, rustc }:
+
+stdenv.mkDerivation {
+ pname = "leetcode-cn_2181";
+ version = "0.0.1";
+
+ src = ./.;
+
+ nativeBuildInputs = [ rustc ];
+
+ buildPhase = ''
+ mkdir -p $out/bin
+ rustc --out-dir $out/bin ./solution.rs
+ '';
+}
A 10/flake.lock => 10/flake.lock +27 -0
@@ 0,0 1,27 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1649117019,
+ "narHash": "sha256-ID7nw/8MDgqj/cbJ0wy6AtQ9wp58hSnE6+weZwuHnso=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "ccb90fb9e11459aeaf83cc28d5f8910816d90dd0",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-21.11",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
A 10/flake.nix => 10/flake.nix +14 -0
@@ 0,0 1,14 @@
+{
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
+ outputs = { self, nixpkgs }:
+ let
+ system = "x86_64-linux";
+ pkgs = nixpkgs.legacyPackages.${system};
+ in rec {
+ defaultPackage.${system} = pkgs.callPackage ./. { };
+ devShell.${system} = with pkgs; mkShell {
+ inputsFrom = [ defaultPackage.${system} ];
+ buildInputs = [ rust-analyzer ];
+ };
+ };
+}
A 10/solution.rs => 10/solution.rs +23 -0
@@ 0,0 1,23 @@
+pub struct Solution {
+ inputs: Vec<(str, str)>
+}
+
+impl Solution {
+ pub fn is_match(s: String, p: String) -> bool {
+
+ }
+}
+
+fn main() {
+ let sln = Solution {
+ inputs: vec![("aa", "a"), ("aaa", "a*"), ("bab", "c")],
+ };
+
+ for input in sln.inputs {
+ println!("input: {}", input);
+
+ let output = Solution::is_match(String::from(input.0), String::from(input.1));
+
+ println!("output: {}", output);
+ }
+}