Skip to content

Instantly share code, notes, and snippets.

View myrtleTree33's full-sized avatar
🦄

jhtong myrtleTree33

🦄
View GitHub Profile
[user]
name = Joel Tong
email = joel.tong@gmail.com
[core]
editor = nvim
ignorecase = false
[init]
defaultBranch = main
[push]
default = current
@myrtleTree33
myrtleTree33 / vertical-horizontal-align.html
Created July 17, 2021 16:55
Tailwind useful snippets
<div class="flex h-screen">
<div class="m-auto">
<h3>title</h3>
<button>button</button>
</div>
</div>
import java.util.ArrayList;
import java.util.List;
public class FlattenBstToLinkedList {
static class Node {
Node left;
Node right;
int val;
}
import java.util.ArrayList;
import java.util.List;
public class ValidBST {
public static class Node {
Node left;
Node right;
int x;
}
import java.util.Arrays;
public class NQueens {
private static boolean nQueens(int[][] board, int col) {
if (col >= board.length) {
return true;
}
import java.util.HashSet;
import java.util.Set;
public class LongestNonrepeatingSubstring {
public static void main(String[] args) {
String input = "pwwkew";
System.out.println(longestNonrepeatingSubstr(input));
}
@myrtleTree33
myrtleTree33 / dijkstra
Created April 19, 2020 13:39
Dijkstra's shortest distance in Java
import java.util.HashSet;
import java.util.Set;
public class Djistrika {
public static final int V = 9;
public static void dijkstra(int[][] graph, int ref) {
// Initialize vars
@myrtleTree33
myrtleTree33 / index.js
Created January 25, 2020 07:30
Mixin functional composition example
const compose = (...fns) => fns.reduceRight(
(prevFn, nextFn) => (...args) => nextFn(prevFn(...args)),
value => value
);
const EatMixin = Superclass => class extends Superclass {
eat(food) {
console.log(`eating ${food}`);
}
@myrtleTree33
myrtleTree33 / cheatsheet.md
Last active December 31, 2019 13:12
Technical Interview Cheat Sheet: Algorithms
@myrtleTree33
myrtleTree33 / quicksort.java
Last active December 31, 2019 13:04
Algorithms / Arrays / Quick Sort
package org.joeltong.test;
import java.util.Arrays;
public class QuickSort {
private static void quickSort(int[] arr) {
quickSort(arr, 0, arr.length-1);
}