Skip to content

Instantly share code, notes, and snippets.

View jianminchen's full-sized avatar

Jianmin Chen jianminchen

View GitHub Profile
@jianminchen
jianminchen / Leetcode742ClosestLeafInABinaryTree.cs
Created September 13, 2023 02:22
742. Closest Leaf in a Binary Tree
/**
* Definition for a binary tree node.
* public class TreeNode {
* public int val;
* public TreeNode left;
* public TreeNode right;
* public TreeNode(int val=0, TreeNode left=null, TreeNode right=null) {
* this.val = val;
* this.left = left;
* this.right = right;
@jianminchen
jianminchen / FindMinimumSubstring.cs
Created July 20, 2023 17:44
C# | Find minimum substring given unique characters
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _76_minimum_window_substring_review
{
class Program
@jianminchen
jianminchen / minimumSubstring.cs
Created July 20, 2023 02:59
Minimum substring | C# | Warmup practice on July 19, 2023
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _76_minimum_window_substring_review
{
class Program
@jianminchen
jianminchen / FlattenDictionary.cs
Created July 19, 2023 01:04
Flatten dictionary - C# code - pramp question - check links inside source code in the following
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FlattenDictionary
{
class Program
{
@jianminchen
jianminchen / SpiralArray.cs
Created July 4, 2023 20:44
2015 submission - Leetcode Spiral array - June 12, 20215
public class Solution {
public IList<int> SpiralOrder(int[,] matrix)
{
IList<int> list = new List<int>();
int len1 = matrix.GetLength(0);
int len2 = matrix.GetLength(1);
int[][] matrix_input = new int[len1][];
<html>
<head>
<title>Using Redis Server with PHP and MySQL</title>
</head>
<body>
<h1 align = 'center'>Students' Register</h1>
<table align = 'center' border = '2'>
@jianminchen
jianminchen / EmailToolTestcode.cs
Last active June 6, 2022 23:01
Prepare a test case for C# - Email - DIOLIG agent - email confirmation setup - June 6, 2022
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestingCode
{
class Program
{
@jianminchen
jianminchen / GivenSumFindExpression.cs
Created March 22, 2022 19:39
Given digits less and equal than 9, find expression using +, - to match given target. March 21, 2022
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace given_target_sum
{
class Program
{
@jianminchen
jianminchen / Leetcode42TrappingRainWater.cs
Created February 23, 2022 19:05
Leetcode 42 Trapping rain water - mock interview on interviewing.io Feb 21, 2020 10:00 PM
using System;
// To execute C#, please define "static void Main" on a class
// named Solution.
/*
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.
height = [0,1,0,2,1,0,1,3,2,1,2,1]
@jianminchen
jianminchen / LowestCommonAncestorWithParent.cs
Created February 23, 2022 18:36
Lowest common ancestor - find LCA in a given binary tree, node p and node q. Use space O(1) to find LCA - interviewing.io mock interview, interviewer shared the following idea. Feb. 22, 2022
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LowestCommonAncestorWithParent
{
class Program