Skip to content

Instantly share code, notes, and snippets.

@ghadj
ghadj / notes.md
Created March 16, 2025 19:13
Java - Dev Interview

*the following is based on the outline provided for Murex Dev Interview.

Learning Content for the Java Interview

Knowledge Domains

I. Language Basics

Click to expand the learning outline for Language Basics
@ghadj
ghadj / System Design.md
Created January 4, 2025 15:03 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@ghadj
ghadj / latency.markdown
Created January 4, 2025 13:42 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@ghadj
ghadj / SolutionBFS.java
Last active November 30, 2024 15:35
Leetcode #199
/**
* ---
* [https://leetcode.com/problems/binary-tree-right-side-view]
* 199. Binary Tree Right Side View
* Given the root of a binary tree, imagine yourself standing on the
* right side of it, return the values of the nodes you can see ordered
* from top to bottom.
* ---
*/
class SolutionBFS {
@ghadj
ghadj / Search my gists.md
Created November 18, 2024 21:00 — forked from santisbon/Search my gists.md
How to search gists.

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@ghadj
ghadj / Solution.java
Created November 18, 2024 20:59
Leetcode #1448
/**
* ---
* [https://leetcode.com/problems/count-good-nodes-in-binary-tree]
* 1448. Count Good Nodes in Binary Tree
* Given a binary tree root, a node X in the tree is named good if in the path from root to X
* there are no nodes with a value greater than X.
*
* Return the number of good nodes in the binary tree.
* ---
*/
@ghadj
ghadj / Solution.java
Created November 17, 2024 21:42
Leetcode #394
import java.util.Stack;
/**
* ---
* [https://leetcode.com/problems/decode-string]
* 394. Decode String
* Given an encoded string, return its decoded string.
*
* The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets
* is being repeated exactly k times. Note that k is guaranteed to be a positive integer.
@ghadj
ghadj / Solution.java
Created November 14, 2024 21:18
Leetcode #735
/**
* ---
* [https://leetcode.com/problems/asteroid-collision]
* 735. Asteroid Collision
* We are given an array asteroids of integers representing asteroids in a row.
*
* For each asteroid, the absolute value represents its size, and the sign represents its
* direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
*
* Find out the state of the asteroids after all collisions. If two asteroids meet, the smaller
@ghadj
ghadj / Solution.java
Created November 14, 2024 20:04
Leetcode #2390
/**
* ---
* [https://leetcode.com/problems/removing-stars-from-a-string]
* 2390. Removing Stars From a String
* You are given a string s, which contains stars *.
*
* In one operation, you can:
* - Choose a star in s.
* - Remove the closest non-star character to its left, as well as remove the star itself.
*
@ghadj
ghadj / Solution.java
Created November 13, 2024 21:20
Leetcode #2352
/**
* ---
* [https://leetcode.com/problems/equal-row-and-column-pairs]
* 2352. Equal Row and Column Pairs
* Given a 0-indexed n x n integer matrix grid, return the number of pairs (ri, cj) such that
* row ri and column cj are equal.
*
* -not fully happy though-
* ---
*/