This is the index for the four programming puzzle problems on this site. Each one has language-specific solutions in JavaScript, Java, Python, or Go — pick the variant that matches what you’re working in. Every solution is tested, runs in linear time, and includes the trade-off between the idiomatic approach and the manual one.

Find the number with the most digits

Given an array of positive integers, return the one with the most digits. If two have the same digit count, return the first occurrence. The trick is choosing between String(n).length (idiomatic, slightly slower) and Math.log10(n) + 1 (mathematical, faster on hot paths).

Permutations of a word, alphabetically ordered

Generate every permutation of a string with no built-in functions. Sort the output alphabetically. The constraint forces a backtracking implementation rather than itertools.permutations. Watch the duplicate-character handling — the standard naive recursion produces duplicates for repeated letters.

Longest vowel substring

Find the longest contiguous substring containing only vowels (aeiou). Linear-scan with a sliding window. The edge cases are the all-consonants string (return empty) and tied lengths (return the first).

Longest alphabetical substring

Find the longest substring where each character is alphabetically ≥ the previous. Linear-scan with reset on break. The edge case is a single-character input (always length 1) and a fully-descending string (also length 1, return the first character).

Why these problems

These four problems show up frequently in junior-engineer screening interviews, particularly for FAANG-tier and FAANG-adjacent roles. They test:

  • Linear-time thinking. All four are solvable in O(n) once you stop reaching for sort or nested loops.
  • Edge-case discipline. Ties, empty input, single-char input, descending input — every solution on this site handles them explicitly.
  • Language idiom familiarity. The same algorithm in JavaScript, Java, Python, and Go reveals where each language helps and hurts.

If you’re prepping for technical screens, work through all four in your weakest language first. The repetition across solutions makes the language idiom stick faster than four unrelated problems would.