Skip to content

Instantly share code, notes, and snippets.

const port = 3000
var cors = require('cors');
const serveStatic = require('serve-static');
const express = require('express')
const app = express()
// var corsOptions = {
// origin: "http://localhost",
use std::{path::Path, fmt::DebugSet};
fn main() {
let mut parser = protobuf_parse::Parser::new();
parser.pure();
let file = Path::new("D:/protos/hello.proto");
parser.include("D:/protos");
parser.input(file);
static int[] GetRanks_Sort(int[] input)
{
int[] sorted = new int[input.Length];
Array.Copy(input, sorted, input.Length);
Array.Sort(sorted);
var ranked = new Dictionary<int, int>();
int rank = 1;
int number = sorted[0];
ranked.Add(sorted[0], rank);
class PriorityQueue
{
private Dictionary<int, int> _frequencies;
public PriorityQueue()
{
_frequencies = new Dictionary<int, int>();
}
public void Add(int item)
@codedjinn
codedjinn / cellphone_combos.cs
Last active February 18, 2021 16:25
When you don't know the algorithm and just wing it...
public class Solution
{
public IList<string> LetterCombinations(string digits)
{
var result = new List<string>();
if (string.IsNullOrEmpty(digits))
{
return result;
}
@codedjinn
codedjinn / Char Mapping.rs
Last active July 7, 2020 16:31
Naive solution to problem
/*
Determine whether there exists a one-to-one character mapping from one string s1 to another s2.
For example, given s1 = abc and s2 = bcd, return true since we can map a to b, b to c, and c to d.
Given s1 = foo and s2 = bar, return false since the o cannot map to two characters.
*/
@codedjinn
codedjinn / rs
Created January 23, 2020 00:47
First stab at solving code problem with rust...
use std::fmt;
use std::num;
const SQUARE:i32 = 0;
const PAWN:i32 = 1;
const KNIGHT:i32 = 2;
const BISHOP:i32 = 3;
const ROOK:i32 = 4;