Firecode.io🔥

647 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 Katılım Nisan 2015
74 Takip Edilen3.3K Takipçiler
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
34
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
40
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
28
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
41
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
66
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🔥 retweetledi
Noah
Noah@NoahKingJr·
Claude watching me write code manually after I hit the daily limit
English
401
5.9K
80.9K
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
Firecode.io🔥
Firecode.io🔥@firecodeio·
tree diameter. most people only check the root: 1 + height(left) + height(right). but the longest path can be entirely inside a subtree. fails in interviews every time.
English
1
0
0
31
Firecode.io🔥
Firecode.io🔥@firecodeio·
the >= start check is probably the most common bug in sliding window problems. people know to store each character's last index, but forget to verify the stored index is actually inside the current window. 'abba' catches it every time. #leetcode
English
1
0
0
22