Hashing: 8 Practice Problems with Solutions
Eight classic hash map problems with worked Python solutions — Two Sum, Group Anagrams, Subarray Sum Equals K, Longest Consecutive Sequence, Top K Frequent Elements, and more.
442 posts · page 9 of 10
Eight classic hash map problems with worked Python solutions — Two Sum, Group Anagrams, Subarray Sum Equals K, Longest Consecutive Sequence, Top K Frequent Elements, and more.
The core operations every linked list problem builds on — inserting at head/tail/middle, deleting by value, reversing iteratively and recursively, finding the middle, and detecting a cycle.
Eight classic linked-list interview problems — reverse, detect cycle, merge sorted lists, remove Nth from end, cycle start, palindrome, add two numbers, and intersection — each with a worked Python solution.
A practical guide to binary search — the classic template, off-by-one traps, Python's bisect module, and the binary-search-on-answer pattern, with six worked problems.
A practical guide to sliding window — fixed-size vs variable-size windows, expand/shrink invariants, and six classic problems with worked Python solutions.
A tour of the five sorting algorithms every programmer should know — their ideas, Big-O time and space, stability, and Python implementations, plus when to just use sort().
Eight classic stack and queue interview problems with worked Python solutions — Valid Parentheses, Min Stack, Daily Temperatures, Sliding Window Maximum, and more.
A practical tour of substring search — the naive O(n·m) scan, the KMP algorithm with its LPS array, and the Rabin-Karp rolling hash. Worked examples, code, and intuition for when to use each.
Eight classic string problems with worked Python solutions — Valid Anagram, Group Anagrams, Longest Substring Without Repeating Characters, Longest Palindromic Substring, and more.
A practical guide to the two pointers technique — opposite-end and same-direction patterns, when to use each, and six classic interview problems with worked solutions.
A practical guide to GraphQL schemas — SDL, scalar types, Query and Mutation roots, custom object types, resolver functions, and how to avoid the N+1 problem with DataLoader.
A practical guide to CSS transitions and @keyframes animations — properties, timing functions, transform-based performance, the animation shorthand, and prefers-reduced-motion.
A practical guide to CSS custom properties — declaring them, using var() with fallbacks, scoping by the cascade, building a light/dark theme, and updating them dynamically from JavaScript.
How to externalize configuration and credentials in Kubernetes — ConfigMap YAML, Secret YAML, mounting as env vars vs files, and patterns for reloading config without rebuilding images.
How Ingress, IngressClass, and Ingress controllers route external HTTP and HTTPS traffic to your Kubernetes Services — with host and path rules, TLS termination, and notes on ingress-nginx vs Traefik.
Named exports, default exports, re-exports, dynamic import, and what actually makes a file a module — the modern JavaScript module system explained.
Why splitting matters, how to use train_test_split with stratification, and the metrics that actually matter — accuracy, precision, recall, F1, confusion matrices, and ROC-AUC.
Why vibes do not scale: building golden datasets, exact-match vs LLM-as-judge scoring, A/B comparing prompts and models, regression suites, and the observability you need to ship safely.
How LLMs call functions: defining tools with JSON schema, the request → tool-call → response loop, common patterns like search and database queries, and the failure modes that bite in production.
A practical guide to React Server Components in Next.js — what runs where, the use client boundary, how to fetch data inside components, and a first look at server actions.
A practical guide to combining and summarising DataFrames — groupby with named aggregations, multi-column aggregates, the four merge styles, and stacking with concat.
How to turn prompts into reusable templates: variables, system messages as contracts, few-shot structure, JSON output schemas, role prompting, and when patterns help versus hurt.
Field-tested REST API design — resource naming, versioning, pagination, filtering, sorting, idempotency, and consistent error envelopes. Conventions that age well in production.
Install, pin, and publish — a practical tour of pip, PEP 621 pyproject.toml, and building a tiny library you can share on TestPyPI.
Isolate your Python projects the right way — using the built-in venv module, the new uv tool, and a clear mental model for when to use pipx instead.
A practical guide to React's Context API — createContext, Provider, and useContext — with the cases it solves cleanly and the cases where you should reach for a state library instead.
Extract stateful logic into reusable custom hooks. The use-prefix rule, three examples (useLocalStorage, useDebounce, useToggle), tuple vs object return values, and how to test them.
How to work with Tailwind's color palette — opacity modifiers, arbitrary values, CSS variables for theming, the dark: variant, and configuring tokens with @theme in Tailwind v4.
Practical patterns for building reusable buttons, cards, and form controls in Tailwind — including variants, the @apply debate, and when to extract a component.
The test-double vocabulary cleared up — mocks vs stubs vs fakes vs spies, when to mock at boundaries, when over-mocking ruins tests, with Python and JavaScript examples.
A practical guide to TypeScript modules — ESM imports and exports, type-only imports, default vs named exports, barrel files, and how tsconfig moduleResolution decides what gets resolved.
A practical guide to narrowing in TypeScript — typeof, instanceof, in, discriminated unions, custom predicates with `x is T`, assertion functions, and exhaustive checks with never.
Use Docker multi-stage builds to ship tiny production images — build with full toolchains, copy only the artifacts. Examples for Node and Go, with .dockerignore and size comparisons.
Understand Git remotes, the difference between origin and upstream, fetch vs pull, the forking workflow, and how to open a pull request that is easy to review.
Learn to stash work in progress, undo commits with restore, reset, and revert, and recover lost work from the reflog — with clear warnings about which commands rewrite history.
A practical guide to arrow functions — concise syntax, implicit returns, and the lexical this that makes them perfect for callbacks but wrong for methods and constructors.
A practical guide to async functions and await — writing asynchronous code that reads like synchronous code, handling errors with try/catch, and running work in parallel.
A complete tour of the ES6 patterns that show up everywhere — object and array destructuring with defaults and renaming, the rest pattern, and spread for copies and merges.
A practical guide to JavaScript functions — declarations vs expressions, hoisting, parameters and arguments, default and rest parameters, return values, and functions as first-class values.
A practical guide to JavaScript promises — states, then/catch/finally, chaining, Promise.all, race, and allSettled, and how to escape the pyramid of doom.
A hands-on tutorial — install Express, define GET/POST/PUT/DELETE routes, parse JSON bodies, use route params, and return proper status codes for an in-memory todos API.
A practical introduction to Python classes — defining a class, __init__ and self, instance vs class attributes, methods, __repr__, and a first look at inheritance.
A practical guide to Python lambda functions — syntax, use with sorted, map, and filter, common patterns, and the situations where a named def is the clearer choice.
A complete guide to controlled forms in React — the value/onChange pattern, handling many fields with one handler, submit handling, basic validation, and textarea and select.
How B-tree indexes work, when CREATE INDEX helps, when it hurts, what EXPLAIN tells you, and the concept of selectivity that decides whether an index is worth its cost.
A practical tour of INNER, LEFT, RIGHT, FULL OUTER, and CROSS joins — when to reach for each, how ON differs from USING, and the Cartesian-product mistake that catches everyone once.
Compose queries from smaller queries — scalar, row, and table subqueries, IN/EXISTS/ANY, correlated subqueries, WITH clauses, and a peek at recursive CTEs. When to prefer a CTE for readability.
A practical tour of Tailwind's layout utilities — flex and grid, alignment, gap, padding and margin, width and height, and responsive prefixes — built around a real card layout example.