Skip to content

Instantly share code, notes, and snippets.

View Youngestdev's full-sized avatar
💭
I may be slow to respond.

Abdulazeez Abdulazeez Adeshina Youngestdev

💭
I may be slow to respond.
View GitHub Profile
@oyekanmiayo
oyekanmiayo / MinimumWindowSubstring.java
Last active October 14, 2020 23:24
Minimum Window Substring
class Solution {
// This approach is O(n), where n = length of string s
// The sliding window approach uses two pointers to traverse a string in linear time. Each character is visited
// at most twice
// There's a method `mapHasAllChars` whose time complexity may not be intuitive, so it's worth mentioning. At most
// each map will contain all the characters from the ascii set (0 - 255), so we know that at most we will always visit 256
// keys every time we call this method. So note this =>
// AS LONG AS WE KNOW THE WORST CASE FOR NUMBER OF LOOP ITERATIONS BEFOREHAND, THAT LOOP'S TIME COMPLEXITY IS CONSTANT
public String minWindow(String s, String t) {
//Edge Cases
@jirevwe
jirevwe / mongoose-walk.ts
Last active June 7, 2019 17:45
Walks through the records in a mongoose collection using a number of cursors
const start_time = performance.now();
const count: number = 1000;
const wallets: Wallet[] = [];
const walletCount = await WalletModel.find({}).estimatedDocumentCount();
// create a cursor for every `currentIndex` documents in the collection
const getNthCursor = async (currentIndex: number) =>
await WalletModel.find({ deleted_at: undefined }, { timeout: false })
.lean()
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active June 11, 2024 07:59
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example