Skip to content

Instantly share code, notes, and snippets.

View n4j's full-sized avatar
⚡ ⚡ ⚡

Neeraj Shah n4j

⚡ ⚡ ⚡
View GitHub Profile
@n4j
n4j / tc.txt
Created August 24, 2025 03:40
1483. Kth Ancestor of a Tree Node (TC)
This file has been truncated, but you can view the full file.
["TreeAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getKthAncestor","getK
@n4j
n4j / tc.txt
Created June 11, 2025 17:22
120. Triangle | Test Cases
[[2], [7, 4], [1, 11, 1990], [9, 4, 20, 23], [6, 1, 0, 19, 95]]
[[10000], [10000, 10000], [10000, 10000, 10000], [10000, 10000, 10000, 10000], [10000, 10000, 10000, 10000, 10000]]
[[10000], [10000, 10000], [10000, 10000, 10000], [10000, 10000, 10000, 10000], [10000, 10000, 10000, 10000, 10000], [10000, 10000, 10000, 10000, 10000, 10000], [10000, 10000, 10000, 10000, 10000, 10000, 10000]]
[[10000], [10000, -10000], [-10000, 10000, -10000], [10000, -10000, 10000, -10000], [-10000, 10000, -10000, 10000, -10000], [10000, -10000, 10000, -10000, 10000, -10000], [-10000, 10000, -10000, 10000, -10000, 10000,-10000]]
[[0]]
[[0], [0, 0]]
[[2],[-3,4],[100,99,7],[4,1,-8,3]]
[[3],[3,3],[3,3,3],[3,3,3,3],[3,3,3,3,3],[3,3,3,3,3,3],[3,3,3,3,3,0,3]]
[[0],[0,0],[0,0,0],[0,0,0,0],[0,0,0,0,0],[0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0
@n4j
n4j / gist:8afc6bac57a394b563a0b5828b7aea5b
Created May 27, 2025 04:08
105. Construct Binary Tree from Preorder and Inorder Traversal
[3,9,20,15,7]
[9,3,15,20,7]
[-1]
[-1]
[3,9,10,20,15,11,7]
[10,9,3,11,15,20,7]
[1,2,4,6,5,3,7,8,9,10]
[4,2,5,6,1,3,8,9,7,10]
[4,5,3,17,2,6,7,1,9,8,10,11,13,14,15,20,19]
[3,2,6,17,1,7,5,9,8,4,10,14,13,11,20,15,19]
@n4j
n4j / tc.txt
Created May 25, 2025 08:49
384. Shuffle an Array
["Solution","shuffle","reset","shuffle"]
[[[1,2,3]],[],[],[]]
["Solution","reset","shuffle"]
[[[-6,10,184]],[],[]]
["Solution","shuffle","shuffle","shuffle","shuffle"]
[[[0,-12893,128384]],[],[],[],[]]
["Solution","shuffle","reset","shuffle"]
[[[1,2,3]],[],[],[]]
["Solution","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle","shuffle"]
[[[83864, 71067, 33380, 66975, 69637, 55810, 59670, 96633, 53092, 62766, 94755, 63926, 73637, 6690, 70811, 91952, -2512, 29605, 96216, 24716, 49664, -994, 7977, 52236, 46364, 30921, 66459, 17510, -9120, 87124, 82817, 25083, -3238, 99903, 82376, -5820, 2420, 8012, 53504, 28441, 73990, 27692, 65073]], [], [], [], [], [], [], [], [], [], [], [], []
@n4j
n4j / tc_53.txt
Created May 11, 2025 11:58
Edgecase for 2140. Solving Questions With Brainpower
This file has been truncated, but you can view the full file.
[[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],[100000,1],
@n4j
n4j / color.erl
Last active August 27, 2022 09:18
Simple code explaining Erlang maps
%% source - https://www.erlang.org/doc/getting_started/seq_prog.html#maps
-module(color).
-export([new/4, blend/2]).
-define(is_channel(V), (is_float(V) andalso V >= 0.0 andalso V =< 1.0)).
new(R,G,B,A) when ?is_channel(R), ?is_channel(G),
?is_channel(B), ?is_channel(A) ->
@n4j
n4j / iterm2-solarized.md
Created December 27, 2017 20:10 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@n4j
n4j / lmdb.tcl
Created April 28, 2017 19:39 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!

Keybase proof

I hereby claim:

  • I am n4j on github.
  • I am n4j (https://keybase.io/n4j) on keybase.
  • I have a public key whose fingerprint is 27EF 685F E428 8EA8 80F2 B9D4 5D6D AB4E C9E0 07E7

To claim this, I am signing this object: