Firecode.io🔥

652 posts

Firecode.io🔥 banner
Firecode.io🔥

Firecode.io🔥

@firecodeio

Official X for https://t.co/Vld8WCWvXi. Coding Interview Prep - Done Right. See what the hype is about at https://t.co/ATzwG2aScM . Status: https://t.co/6axW7NL9tO

San Francisco, CA Sumali Nisan 2015
74 Sinusundan3.3K Mga Tagasunod
Firecode.io🔥
Firecode.io🔥@firecodeio·
Insert Interval is O(n) not O(n log n) because the input is pre-sorted. three cases: before (pass through), overlap (expand), after (output insert, swap current in). that swap is why out.add(insert) always works at the end. firecode.io/firelogs/probl…
English
0
0
0
9
Firecode.io🔥
Firecode.io🔥@firecodeio·
Spiral Matrix clicks once you see it as ring peeling. four pointers (top, bottom, left, right), shrink inward each loop. the bug: no boundary check before the bottom row traversal means double-counting on rectangular matrices. draw it on paper first. firecode.io/firelogs/probl…
English
0
0
0
20
Firecode.io🔥
Firecode.io🔥@firecodeio·
Rotate Image: transpose then reverse each row = 90 degrees clockwise, O(1) space. One trap: in the transpose loop, j starts at i, not 0. Start at 0 and every pair swaps twice, matrix ends up unchanged. Easy to miss. Google, Meta, Amazon ask this. firecode.io/firelogs/probl…
English
0
0
0
49
Firecode.io🔥
Firecode.io🔥@firecodeio·
Majority Element II: at most 2 elements can exceed n/3 (pigeonhole). track 2 Boyer-Moore candidates instead of 1. cancellation eliminates triplets. second pass verifies. O(n), O(1). Adobe asks this constantly. firecode.io/firelogs/probl…
English
0
0
0
29
Firecode.io🔥
Firecode.io🔥@firecodeio·
Most people dp-table Unique Paths. works fine. but you can also use combinatorics: m+n-2 total moves, exactly m-1 go down. that's C(m+n-2, m-1). O(m+n), no table, no iteration. breaks with obstacles, but clean for the base case. firecode.io/firelogs/probl…
English
0
0
0
23
Firecode.io🔥
Firecode.io🔥@firecodeio·
Valid Anagram is where interviewers find out if you know the 26-int array trick. HashMap works but `c - 'a'` to map chars to indices, +1 for s, -1 for t, check all zeros is cleaner. O(1) space. Google, Bloomberg, Adobe all ask this. firecode.io/firelogs/probl…
English
0
0
0
38
Firecode.io🔥
Firecode.io🔥@firecodeio·
Bottom-up level order traversal is just BFS + reverse. One catch: enqueue the right child BEFORE the left child. Miss that, each level in your reversed output reads right-to-left instead of left-to-right. Microsoft, Amazon, Apple ask this. firecode.io/firelogs/probl…
English
0
0
0
44
Firecode.io🔥
Firecode.io🔥@firecodeio·
Jump Game: track maxReach (farthest reachable index so far). if current index > maxReach, you're stranded, return false. update maxReach = max(maxReach, i + nums[i]). that's it. one pass, O(n) time, O(1) space. Amazon, Google, Meta all ask this. firecode.io/firelogs/probl…
English
0
0
0
30
Firecode.io🔥
Firecode.io🔥@firecodeio·
Group Anagrams clicks when you find the canonical form. "eat", "tea", "ate" all sort to "aet". that's your hash map key. group by it. the lesson: any equivalence problem has a canonical form hiding in it. asked at Amazon, Google, Meta. firecode.io/firelogs/probl…
English
0
0
0
44
Firecode.io🔥
Firecode.io🔥@firecodeio·
3Sum is just Two Sum with an extra loop. Sort, fix one element, two-pointer scan for pairs summing to -nums[i]. That's your O(n^3) to O(n^2) reduction. What actually bites people: duplicate avoidance needs 3 separate skip checks. Miss one and you get dupes. firecode.io/firelogs/probl…
English
0
0
0
77
Firecode.io🔥
Firecode.io🔥@firecodeio·
Product of array except self: obvious solution is divide by nums[i]. no division constraint kills that anyway. actual fix: prefix products left-to-right, suffix products right-to-left. O(n), no division needed. Amazon, Google, Meta all ask this. firecode.io/firelogs/probl…
English
0
0
0
31
Firecode.io🔥
Firecode.io🔥@firecodeio·
Rotated sorted array: intimidating but it's just binary search with one extra observation. At any midpoint, one half is always sorted. Compare nums[left] with nums[mid] to find which. Check if target is in that range. Search accordingly. Still O(log n). firecode.io/firelogs/probl…
English
0
0
0
33
Firecode.io🔥
Firecode.io🔥@firecodeio·
Generate parentheses trips people up when they reach for brute force. you don't need generate-and-filter. one condition handles everything: only add ')' when closeRemaining > openRemaining. n=3 outputs exactly 5 strings. that's the 3rd Catalan number. firecode.io/firelogs/probl…
English
0
0
0
23
Firecode.io🔥 nag-retweet
Noah
Noah@NoahKingJr·
Claude watching me write code manually after I hit the daily limit
English
401
5.9K
80.8K
3.7M
Firecode.io🔥
Firecode.io🔥@firecodeio·
container with most water is really a proof question disguised as a coding problem. short line limits the area. moving the tall pointer just loses width while keeping that same limit. always move the short one.
English
1
0
0
29
Firecode.io🔥
Firecode.io🔥@firecodeio·
everyone solves LIS with O(n^2) DP. the follow-up 'can you do better?' is where candidates freeze. the tails array stays sorted throughout the scan. binary search it instead of the inner loop. O(n log n).
English
1
0
0
31
Firecode.io🔥
Firecode.io🔥@firecodeio·
the 301 vs 302 redirect is a sneaky URL shortener design gotcha. 301 is 'permanent' so browsers cache the destination and stop hitting your server. you lose click analytics entirely. bit.ly and most real shorteners use 302 precisely because they need tracking data
English
1
0
0
33