Phi-3 — Microsoft Small Language Model Guide
Complete guide to Microsoft's Phi-3: tiny but capable models.
48 articles
Complete guide to Microsoft's Phi-3: tiny but capable models.
Build complex multi-agent systems with Microsoft AutoGen framework.
Build AI applications with Microsoft Semantic Kernel SDK.
Learn why LeetCode 121 is a FAANG staple — not because it is hard, but because of what it reveals about your thinking. Master the running-minimum insight, avoid the global min/max trap, and understand all five stock variants from 121 to 309.
LeetCode 283 is the gateway to the two-pointer partition pattern used across dozens of harder problems. Learn why it appears in almost every Microsoft and Amazon phone screen, master the write-pointer mental model with a step-by-step dry run, and understand when to swap vs. overwrite — with Python and JavaScript solutions fully annotated.
Most candidates try to merge nums1 and nums2 from the front and run into a subtle overwrite bug. Learn why starting from the back is the key insight, how three pointers keep the logic clean, and how this same trick powers the merge step in Merge Sort. Full Python and JavaScript solutions included.
Master the write pointer pattern — the canonical technique for in-place array modification. Full walkthrough of LeetCode 26 with visual dry run, common mistakes, and the LC 80 generalization. Python and JavaScript solutions included.
Return the third distinct maximum or the max if fewer than 3 distinct values exist. Three-variable tracking O(n) O(1) solution.
Traverse an m×n matrix in spiral order. Master the boundary-shrinking technique — maintain top, bottom, left, right walls and peel layer by layer. Covers edge cases, visual dry run, common bugs, Python & JavaScript solutions, and follow-ups like Spiral Matrix II.
LeetCode 189 looks trivial — until the interviewer asks for O(1) space. Learn why three distinct approaches exist, the mathematical reason triple-reverse works, every common pitfall (wrong k, direction confusion, off-by-one), a full visual dry run, and how this trick unlocks Rotate String, Rotate Image, and beyond.
Find the minimum element in a rotated sorted array with no duplicates. Binary search: the minimum is in the unsorted half. O(log n) time O(1) space.
LeetCode 152 looks like a simple extension of Maximum Sum Subarray — until you hit negative numbers. A negative times a negative is positive, which means the current minimum can instantly become the new maximum. Learn why tracking BOTH cur_max and cur_min is the essential insight, how zeros act as hard resets, the four bugs every candidate makes, and step-by-step dry runs on key examples. Python and JavaScript solutions from O(n²) brute force to the elegant O(n) DP approach.
Next Permutation is not just an array problem — it is a test of systematic algorithmic thinking under pressure. Learn why you scan from the right, why you swap with the smallest larger element, and why the suffix is reversed rather than sorted. Includes full visual dry runs, the 4 most common bugs, and Python + JavaScript solutions.
Master Dijkstra's Dutch National Flag algorithm to sort 0s, 1s, and 2s in a single pass with O(1) space. Understand the three-pointer invariants, the critical bug most candidates make, and how this pattern unlocks a family of partition problems.
Generate all permutations of distinct integers using in-place swap backtracking.
Find the smallest contiguous subarray with sum >= target using the shrinkable sliding window technique.
Search for a word in a 2D grid using DFS backtracking with in-place visited marking.
Find minimum number of jumps to reach the last index using greedy BFS-style level tracking.
Find the missing number in [0..n] using the Gauss sum formula or XOR in O(n) time O(1) space.
LeetCode 42 is a benchmark Hard problem used by Amazon, Google, and Meta to test whether you can derive an insight — not just memorize code. Learn all three approaches (brute force, prefix arrays, two pointers) and — crucially — understand WHY the two-pointer invariant works.
Most candidates brute-force this in O(n·k) and hit TLE. Learn the monotonic deque invariant that reduces it to O(n) — with a step-by-step dry run, the five common bugs that break implementations, and why this pattern unlocks Jump Game VI and Constrained Subsequence Sum.
LeetCode 41 is a landmark Hard problem because both obvious approaches — hash set and sorting — are explicitly banned by the constraints. Learn the mathematical insight that bounds the answer to [1, n+1], then master two O(n) time, O(1) space techniques: index marking via sign negation and cyclic sort placement, with a full visual dry run, bug catalogue, and FAANG follow-ups.
Master LeetCode 84 the right way. Learn exactly why bars are popped from the monotonic stack, how to calculate left/right boundaries without bugs, the sentinel-values trick that eliminates edge cases, and a step-by-step dry run on [2,1,5,6,2,3] — plus how this pattern extends directly to Maximal Rectangle (LC 85).
LeetCode 4 is one of the most feared Hard problems in FAANG interviews. Learn exactly why the partition insight works, trace through a full binary search dry run, understand the five common bugs that cause silent wrong answers, and walk away with production-quality Python and JavaScript solutions.
Find the largest rectangle of 1s in a binary matrix by treating each row as a histogram and applying the Largest Rectangle in Histogram algorithm.
Find two indices that add to target in O(n) by storing each number in a HashMap and looking up the complement.
Check if two strings are anagrams by comparing their character frequency counts using an array or HashMap.
Determine if a number is happy by repeatedly summing digit squares and detecting cycles using a HashSet or Floyd algorithm.
Group strings that are anagrams together by using their sorted form as a HashMap key.
Find the k most frequent elements in O(n) using bucket sort by frequency instead of a heap.
Design a Least Recently Used cache with O(1) get and put operations using a HashMap combined with a doubly linked list.
Check if a string is a palindrome after removing non-alphanumeric characters using inward two pointers.
Reverse an array of characters in-place using the classic two-pointer swap technique.
Remove duplicates in-place from a sorted array using a write pointer that only advances on unique elements.
Merge two sorted arrays in-place from the end to avoid overwriting elements using three pointers.
Find the maximum number of consecutive 1s achievable by flipping at most k zeros, using a variable sliding window.
Find the longest substring without duplicate characters using a HashSet-backed shrinkable sliding window.
Find the longest substring with at most k character replacements by tracking the maximum frequency char in the window.
Check if any permutation of s1 is a substring of s2 using a fixed-size sliding window with character frequency comparison.
Maximize water trapped between two vertical lines using inward two pointers that always move the shorter line inward.
Find all unique triplets summing to zero by sorting and using two pointers for each fixed element with careful duplicate skipping.
Find two numbers summing to target in a 1-indexed sorted array using inward two pointers in O(n) time O(1) space.
Find k closest integers to x in a sorted array using binary search to locate the optimal left boundary of the window.
Find the maximum consecutive ones in a binary array when you can flip at most k zeros, identical to the Max Consecutive Ones III pattern.
Find the smallest window in s containing all characters of t using a have/need counter to track when the window is valid.
Find the maximum in every sliding window of size k in O(n) using a monotonic decreasing deque of indices.
Sort an array of 0s, 1s, and 2s in one pass using the Dutch National Flag 3-pointer algorithm.
Calculate trapped rainwater using optimal two-pointer approach that tracks left and right maximums without extra space.