This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use rand::rngs::StdRng; | |
| use rand::seq::SliceRandom; | |
| use rand::SeedableRng; | |
| use std::collections::HashSet; | |
| pub fn gen(rows: usize, cols: usize, seed: u64) -> Maze { | |
| MazeGenerator::new(rows, cols, seed).gen() | |
| } | |
| pub struct Maze { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::collections::HashSet; | |
| use std::fmt::{Debug, Formatter}; | |
| #[derive(Clone)] | |
| pub struct SudokuBoard { | |
| cells: Vec<SudokuCell>, | |
| } | |
| #[derive(Debug, Clone)] | |
| pub enum SudokuCell { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run at first launch in day | |
| LAST_RUN="$HOME/.last_run" | |
| if [ ! -f "$LAST_RUN" ] || [ "$(cat $LAST_RUN)" != "$(date +"%Y%m%d")" ]; then | |
| # TODO: do sth here | |
| date +"%Y%m%d" > "$LAST_RUN" | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use rand::Rng; | |
| use std::fmt::{Display, Formatter, Result}; | |
| pub struct Worker<T> { | |
| arr: Vec<T>, | |
| begin: usize, | |
| end: usize, | |
| } | |
| impl<T> Display for Worker<T> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "sync" | |
| "sync/atomic" | |
| "time" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| typedef struct SinglyLinkedListNode { | |
| int value; | |
| struct SinglyLinkedListNode* next; | |
| } SinglyLinkedListNode; | |
| SinglyLinkedListNode* reverseSinglyLinkedList(SinglyLinkedListNode* list); | |
| SinglyLinkedListNode* reverseSinglyLinkedListHelper(SinglyLinkedListNode* listToReverse, SinglyLinkedListNode* listToAppend); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| #include <unistd.h> | |
| void performTask(int id, int readfd, int writefd) { | |
| FILE* readFile = fdopen(readfd, "r"); | |
| FILE* writeFile = fdopen(writefd, "w"); | |
| char requestBuffer[100]; | |
| while (fscanf(readFile, "%s", requestBuffer) != EOF) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class KMP { | |
| private final String pattern; | |
| private final int[] next; | |
| public KMP(String _pattern) { | |
| if (_pattern == null) { | |
| throw new IllegalArgumentException("pattern cannot be null"); | |
| } | |
| else if (_pattern.isEmpty()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Map; | |
| import java.util.Set; | |
| import java.util.TreeMap; | |
| import java.util.TreeSet; | |
| public class ShortestSubsequenceInterval { | |
| public static void main(String[] args) { | |
| String[] words = {"*", "*", "*", "-", "*", "*", "*", "-", "*", "*", "*", "*"}; | |
| String[] keys = {"*", "*", "*", "*"}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.function.Consumer; | |
| public class BSTTraverser { | |
| public enum TraverseOrder { | |
| PreOrder, InOrder, | |
| } | |
| public static void main(String[] args) { | |
| BST bst = new BST(); |
NewerOlder