New answers tagged

2 votes

Solution to Codejam 2022 1C (Letter Blocks) in Ruby

The valid_tower? predicate is very nice. tiny nit: sorted_tower.squeeze! tower.squeeze.size == sorted_tower.size Go for ...
  • 7,066
1 vote

Solution to a competive programming contest (Codejam 2011 1A)

I'm just going to comment on one function for now, since it's what I have time for. This is a "C in ruby" style approach rather than idiomatic ruby: ...
  • 4,270
1 vote

Solution to a competive programming contest (Codejam 2011 1A)

I am reading main. I like it. I was going to grumble about "identifiers are too terse, use the same business terms found in the spec." But then I read the ...
  • 7,066
2 votes

Parse a document and returning uniqueness and total number occurrences

How can I make this code better? By making it simpler and shorter. The current solution creates many unnecessary abstractions. Idiomatic ruby should embrace the built-in methods of ...
  • 4,270

Top 50 recent answers are included