Skip to content

Instantly share code, notes, and snippets.

View mikkqu's full-sized avatar

Mikhail Kalashnikov mikkqu

View GitHub Profile
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <random>
using namespace std;
typedef vector<vector<int>> vector_2d_t;
typedef vector<vector<vector<int>>> vector_3d_t;
@mikkqu
mikkqu / doubly-linked-list.js
Created May 19, 2018 08:51
Doubly linked list in Javascript
class DListNode {
constructor(val, next = null, prev = null) {
this.val = val
this.next = next
this.prev = prev
}
}
/*
@mikkqu
mikkqu / singly-linked-list.js
Last active May 19, 2018 08:56
Singly linked list in Javascript
class ListNode {
constructor(val, next = null) {
this.next = next
this.val = val
}
}
/*
Interface:
insertAtHead(val)
@mikkqu
mikkqu / flatten-multilevel-list.js
Last active May 17, 2018 22:10
Flatten a multilevel doubly linked list
class Node {
constructor(val, prev = null, next = null, child = null) {
this.val = val
this.prev = prev
this.next = next
this.child = child
}
}
let print = (head) => {