Skip to content

docs: explain Rank Transform of an Array in plain English - #195

Merged
Huerte merged 1 commit into
Huerte:mainfrom
painbaba:issue-191-explain-practice343
Nov 7, 2026
Merged

Huerte merged 1 commit into
Huerte:mainfrom
painbaba:issue-191-explain-practice343

Conversation

@painbaba

@painbaba painbaba commented Nov 7, 2026

Copy link
Copy Markdown

Summary

solutions/python/practice343.py had no explanation beyond the header. This adds a beginner-friendly plain-English walkthrough of the rank-transform trick: what a rank is, how sorted(set(...)) + zip + dict build the value-to-rank lookup table, why duplicates share a rank and ranks have no gaps, plus a small worked example and the time (O(n log n)) and space (O(n)) complexity.

Comments only — the diff is +24/−0 and no code line is touched, so the solution and its example output are unchanged. Also added the Note: line required by the repo's header convention for changed solution files.

Related issue

Closes #191

Validation

  • python -I solutions/python/practice343.py on Windows, Python 3.11.15: the three example outputs are exactly the previously commented values ([5,3,4,2,8,6,7,1,3], [4,1,2,3], [1,1,1]).
  • git diff shows insertions only (no deletions) — confirming a comments-only change.
  • Repository header validator (python -I scripts/check_solution_headers.py --base upstream/main --head HEAD): passed.

Checklist

  • The solution includes the required problem, source, and note header comment.
  • The file is in the correct solutions/<language>/ folder and follows the practice<n> naming convention.
  • I ran the solution and checked that it works.
  • I have kept this pull request focused on one change.

@Huerte
Huerte merged commit 0a2c4c4 into Huerte:main Nov 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No coding needed: explain a solution in plain English (5 min)

3 participants