Rule of thumb [terminology]
Terminology¶
Usage¶
n: size of a one-dimensional sequencem,n: matrix row and column countsi,j,k: short-lived generic indicesidx: one explicitly named indexr,c: row and column coordinatesdr,dc: coordinate direction offsetsnr,nc: neighboring row and columnl,r: moving positional boundaries or pointerslo,hi: lower and upper value boundsstart,end: meaningful interval or substring boundariestop,bottom,left,right: four rectangular boundariesmid: midpoint or split positionw,r: write and read indicesx: generic numeric sequence elementval: extracted, stored, or parsed valuech: current or individual charactera,b: symmetric arithmetic operandsres: constructed return collectionans: generic final scalar answerbest: optimum found so fartotal: additive accumulationcnt: scalar countcounts: item-to-count mappingfreq: one frequencyfreqs: frequency mappingacc: general non-specific accumulatorprofit,gain: domain-specific financial quantitiescur,prev,nxt: current, previous, and next stateprev1,prev2: one and two positions backnode: currently processed noderoot,head,tail: structural endpointsdummy: sentinel nodeslow,fast: different-speed pointersq: single compact BFS queuestack,heap: preserve data-structure semanticspath: choices in the current backtracking branchfront,back: bidirectional search frontierslevel: nodes or values at one depthdepth: numeric distance from a tree rootseen: previously encountered values or statesvisited: graph or grid elements already traversedused: currently unavailable choices or resourcescand: provisional candidateprefix,suffix: directional accumulation around an indexrev: reversed representation under constructiondigit: one numeric digitrem: arithmetic remainderint_part: integer part of a fractionnum_str: string representation of a numberbase: current exponentiation basecarry: propagated arithmetic statepartial: incomplete intermediate resultmask: bitwise maskordered: sorted or deliberately arranged statewidth: span or merge-run widthsize: general element count for a groupparts: pieces that will be joinedalphabet: complete substitution character set
Why these variable names matter:
- Interviewers expect them.
- They compress explanation.
- They make standard patterns recognizable fast.