Translate an algorithm into reliable code without losing time to collection APIs, iteration rules, mutation, or return shapes.
Free~16 min
What is language fluency?
Language fluency is the ability to turn an algorithm you understand into correct, readable code without the language becoming the bottleneck. In an interview, that means choosing the right collection operation, spelling its API correctly, iterating over the intended values, preserving the mutation contract, and returning exactly the requested shape.
The coach treats this separately from algorithm knowledge. A missed collection method does not erase evidence that you understand frequency counting. A correct solution in another language does not prove that you can express the same operations in the language you selected. Algorithm and data-structure evidence is shared; syntax and collection friction belongs to the selected language.
Note
Anchor the language you plan to use - the coach's language choice controls fluency recommendations and which runnable lab variant opens, while your algorithm profile continues across languages.
Core operations
Start from the operation your algorithm needs, then select the language form. This keeps API recall attached to a durable concept instead of a memorized line.
Note
Name the operation before the method - if you can say "read this count with zero as the fallback," you can recover the exact API from a small language table instead of guessing among similar methods.
Key patterns
Collections
Syntax
When to reach for language fluency
You can explain the algorithm aloud but repeatedly search for basic collection methods while coding it.
A review finds the right data structure with the wrong read, write, membership, or default-value API.
Your loop visits keys, indices, or entries when the algorithm expects values.
A numeric sort passes small examples but fails on values with different digit lengths.
Tests reveal that the solution mutated an input the contract promised to preserve.
The computed value is correct in the console, but the function returns the wrong shape or no value.
Similar syntax or collection findings recur in fresh problems written in the same language.
Done reading? Mark it so it sticks in your dashboard.
Discussion
Language
Intent
Python
Map create
mapping = {}
Map membership
key in mapping
Map read with fallback
mapping.get(key, fallback)
Map write
mapping[key] = value
Set membership
value in seen
Append
values.append(value)
Last item
values[-1]
Index and value
enumerate(values)
Numeric ascending sort
sorted(values)
Shallow copy
values.copy()
Use dictionaries and sets when the algorithm needs keyed state or constant-time average membership. Keep reads, membership tests, and writes distinct so missing data cannot silently look like a stored value.
When to use - frequency maps, complement lookup, grouping, deduplication, visited state, and any algorithm that asks whether a value has appeared before.
How it works - a dictionary stores a value for each hashable key; a set stores keys without associated values. Use in when presence matters and .get when a fallback value is part of the contract. Use defaultdict(list) only when every missing key should create the same kind of fresh bucket.
from collections import defaultdict
counts: dict[str, int] = {}
groups: defaultdict[str, list[str]] = defaultdict(list)
seen: set[str] = set()
for word in ["tea", "eat", "tan"]:
counts[word] = counts.get(word, 0) + 1
groups["".join(sorted(word))].append(word)
seen.add(word)
Note
Presence and truthiness answer different questions - use key in mapping when 0, False, an empty string, or an empty list is valid stored data.
Build interview loops from a few dependable forms: direct value iteration, enumerate for indices, zip for parallel sequences, and .items() for dictionary pairs.
When to use - translating a traversal into code, constructing an output list, walking two sequences together, or preserving the input while computing a result.
How it works - choose the iterator whose yielded shape matches the loop body. Prefer an expression that creates a new result when the contract says the input must remain unchanged. Return the result explicitly; printing it only changes console output.
def normalize_scores(scores: list[int]) -> list[int]:
ordered = sorted(scores)
return [score - ordered[0] for score in ordered]
for index, score in enumerate(normalize_scores([8, 3, 5])):
print(index, score)
Note
Sort versus sorted is a contract choice - list.sort() mutates and returns None; sorted(iterable) returns a new list and leaves the input alone.