Arrays

3 problems from Rosalind — Algorithmic Heights. Press Run on any block to execute it in your browser.

MAJ — Majority Element

solved Problem statement

Writing this found that `{}` parsed as an empty block and evaluated to nil, so a tally could not be opened the obvious way. Fixed in the parser; `{}` in value position is now an empty map.

2SUM — 2SUM

solved Problem statement

Any valid pair is accepted, so the answers are checked against the definition rather than against the sample string: the scan reaches 8 and -8 first and reports 1 5 where the sample reports 2 4.

3SUM — 3SUM

solved Problem statement