Questions tagged [rags-to-riches]

Rags-To-Riches is the tag of choice for entries to the corresponding CR-Game as proposed on meta. Questions tagged with this tag are polished Stack Exchange posts asking for a review.

Filter by
Sorted by
Tagged with
5 votes
1 answer
128 views

C++ Mine Sweeper Attempt

Saw this question and though I wanted to try. So my version of reading Mine Sweeper: For the Online Judge Some Utilities Classes ...
user avatar
  • 91.5k
4 votes
0 answers
438 views

Scraping OddsPortal with requests only

This is a scraper written to do most of what had been attempted by another user in this question: How can I optimise this webscraping code I did the rewrite because I felt bad that the new user didn't ...
user avatar
  • 47.7k
11 votes
1 answer
207 views

Resizable containers with VueJS

A month ago I reviewed the code in Resizable split DIVs Vue.js, suggesting that the OP use computed properties and bound styles to simplify the code (at least reducing the need to use ...
user avatar
6 votes
2 answers
2k views

Python Rock-Paper-Scissors via a class to handle the game

Original inspiration was by this Python beginner, and it prompted me to rewrite a bunch of stuff with my flair and my Python experience: First attempt: Python Rock Paper Scissors Okay, so I looked at ...
user avatar
  • 2,478
5 votes
1 answer
68 views

Rename files by editing their names in an editor

Inspired by a recent question to rename files by editing the list of names in an editor, I put together a similar script. Why: if you need to perform some complex renames that are not easy to ...
user avatar
  • 107k
7 votes
1 answer
452 views

Rock-Paper-Scissors engine

Looking over Rock, Paper, Scissors. C++ from a beginning programmer prompted me to think about how I'd program this simple game in C++. The RockPaperScissors class ...
user avatar
  • 64.1k
6 votes
1 answer
158 views

Multithreaded testing for counting rooms from a floor plan solution

This is version 3 of Efficiently counting rooms from a floorplan. Version 2 is here Efficiently counting rooms from a floorplan (version 2) It also has a comprehensive test facility that is the ...
user avatar
  • 64.1k
4 votes
2 answers
96 views

Polishing partitions - Reimplementing a partitionOn

So I've read an F# question on partitioning a list in F# and wondered whether I could cleanly write the concept down in haskell and if that would help me review the code ... Now I have a haskell ...
user avatar
  • 25k
11 votes
4 answers
2k views

Homemade cyraz encryption algorithm

The "Cyraz" encryption algorithm was presented on SOPT community. This algorithm makes a cypher using a private key given in byte[] format with any arbitrary ...
user avatar
  • 5,561
15 votes
1 answer
6k views

Simple linear equation solver

In working on a review for Solve a set of "restricted" linear equations efficiently, I decided to reimplement from scratch using the method I proposed in my answer. The application I won't ...
user avatar
  • 64.1k
6 votes
1 answer
95 views

Object oriented, runtime expandable Sieve of Eratosthenes

In answering this question, it seemed to me that it would be nice to have a runtime expandable Sieve of Eratosthenes. This is my implementation of that notion. Design I've created a class named <...
user avatar
  • 64.1k
11 votes
1 answer
267 views

Check consistency of statements, with fuzzy rhyme matching (Kattis "Mårten's Theorem" challenge)

I wrote a review for Check consistency of a list of statements, with fuzzy rhyme matching, which basically required me to try writing my own solution to fully understand the challenge. So, I thought ...
user avatar
3 votes
1 answer
919 views

Calculator with history using Java 8

Yesterday, I saw this post from another user: Calculator with history I started refactoring the code while typing an answer but I end up not posting as an answer because I not sure if my ...
user avatar
  • 504
8 votes
2 answers
8k views

Accessing properties by name with compile-time typesafety

I've recently answered a question here, where the goal is to mimic some functions from System.Reflection in order to avoid it's direct usage as much as possible, ...
user avatar
  • 8,418
6 votes
1 answer
514 views

Locating the largest Collatz Sequence with memoization

Inspired by this question I wrote a memoized form of the collatz sequence calculator. The idea was to cache the sequence lengths for as many sequences as possible, from 0 to some value. I managed to (...
user avatar
10 votes
6 answers
3k views

Too Many Staff Meetings

I recently got in really deep on a question to find the overlapping meetings and I rewrote a bit of the code and added some things to the code, and I would just like a general review of my code and ...
user avatar
  • 28.5k
5 votes
1 answer
2k views

Making sure a sentence exists of words in a dictionary

Today on Stack Overflow the following question came https://stackoverflow.com/questions/39393112/find-out-if-string-contains-english-words-only The question itself has following prerequisites: A ...
user avatar
  • 825
9 votes
1 answer
360 views

Scrabble tile-counting challenge

While reviewing this Scrabble Tile Counter, I decided to give it a try myself. Here is the challenge, from Reddit's /r/dailyprogrammer: Description For this challenge we will be using the ...
user avatar
7 votes
1 answer
1k views

Alternate letters to UpperCase

As an exercise I repeated this Java question, but in Go: Convert string to mixed case The objective is for every second letter to be converted to uppercase. Go string processing is relatively new to ...
user avatar
  • 96.7k
6 votes
1 answer
796 views

Shortest knight path

In preparing a review of this question, I decided to rewrite the code from scratch using a more object oriented approach as I suggested in my review. To recapitulate the problem statement, we are ...
user avatar
  • 64.1k
10 votes
1 answer
2k views

Read stdin like a dictator

Rags. Introduction All too often I find myself wanting to allow only a certain list of characters to be written to stdin, and only recently did I actually bother ...
user avatar
  • 977
3 votes
1 answer
1k views

Needle in a Haystack

This is a rags-to-riches of some recent "search word in multiple files" questions, such as this deleted question and this. The idea here is to do a case-insensitive word (complete, not partial) ...
user avatar
  • 19.1k
7 votes
1 answer
872 views

A generic implementation of Dijkstra

Here is an implementation of Dijkstra As an rags-to-riches version of this Object oriented approach to Dijkstra's algorithm ...
user avatar
  • 91.5k
11 votes
3 answers
631 views

Multithreaded Mandelbrot Generator Ver 2

Update: Version 3 is here. My first version was an answer I provided to EBrown for his original post titled "Multithreaded Mandelbrot Generator". My answer had many good things in it, but I felt ...
user avatar
  • 5,522
11 votes
1 answer
318 views

What's my personality?

This is a rags-to-riches take on this question, specifically an improvement of my original answer there. Copying my interpretation of the calculations involved from my answer: Given a 70-character <...
user avatar
  • 19.1k
40 votes
6 answers
3k views

SHOUTY_SNAKE_CASED NUMBERS

WE_ALL_LOVE_SHOUTY_SNAKE_CASE_SO_I_WROTE_A_PROGRAM_FOR_IT!!1! Alright, enough of this. This is a rags-to-riches from this question. The pattern is pretty simple, it takes a ...
user avatar
  • 12.2k
4 votes
2 answers
518 views

Partitioning a string into chunks

Inspired by this question: Split a string into chunks of the same length The code is designed to work on text elements rather than chars to avoid unicode problems. ...
user avatar
  • 16.6k
7 votes
2 answers
204 views

99 times drunk on Java

This is a rags-to-riches attempt from this question, based on the popular 99 Bottles of Beer, by (lightly) using Java 8's stream-based processing. Any room for improvement in terms of readability? I ...
user avatar
  • 19.1k
5 votes
2 answers
16k views

Capitalize the first letter of all words in a String

A rags-to-riches of A method to capitalize the first letter of all words in a String. To recap the requirements: Please implement this method to capitalize all first letters of the words in the ...
user avatar
  • 2,722
11 votes
3 answers
5k views

Fastest possible text template for repeated use?

While reviewing Sending templatized e-mail to a million contacts, I wrote this implementation to illustrate an alternate approach. It is designed to be the fastest possible way to generate templated ...
user avatar
6 votes
2 answers
512 views

Rock, Paper, Scissors, Lizard and Spock with OOP

Today I saw an extremely interesting question on the Rock, Paper, Scissors, Lizard and Spock game. I've decided to take my swing at it and I've written the following OOP implementation: ...
user avatar
22 votes
5 answers
1k views

Numbers, pairs, and a difference

Problem statement: Write a function which returns the total number of combinations whose difference is k. For example, ...
user avatar
4 votes
1 answer
124 views

Twisting words! (boustrophedon formatting)

I decided to implement properly the Code Golf challenge about twisting strings. I report the assignement verbatim for convenience: Twisting Words! Given a string and a positive integer. You ...
user avatar
  • 27k
8 votes
2 answers
285 views

Desktop notifications for queue items

I wasn't satisfied with Simon's alert on the orange alert. I wanted to know if even 1 review item was available, so I made some modifications to the userscript so that it runs on the Review page, and ...
user avatar
  • 28.5k
5 votes
1 answer
126 views

How much time is left?

rags-to-riches of Convert seconds to hours, minutes and seconds. In that question, BigDecimal was chosen to be the model class, which doesn't seem like a right fit ...
user avatar
  • 19.1k
14 votes
5 answers
595 views

Checking three values are consecutive

This question was recently asked: Determining if three numbers are consecutive It intrigued me, even though it was broken. I have the following implementation I thought would be interesting, and I am ...
user avatar
  • 96.7k
3 votes
4 answers
470 views

Are the words isomorph?

Are the words isomorphs? (Code-Golf) This is my non-golfed, readable and linear (quasi-linear?) in complexity take of the above problem. For completeness I include the description: Two words are ...
user avatar
  • 27k
7 votes
6 answers
3k views

Super Market Checkout Pricing Strategies

I saw this question and thought it looked like a great opportunity to try my hand at the Strategy Pattern. I've never used it before, but I think I did pretty well. Did I? The code below can also be ...
user avatar
  • 30.7k
7 votes
1 answer
1k views

Project Euler 67 - Max path through triangle

This is a response to this brute-force version where the algorithm was not intended for review. In this challenge you are prompted to find the path through a large triangular set of numers, similar ...
user avatar
  • 96.7k
6 votes
2 answers
570 views

Merging word streams from files

A follow-on, rags-to-riches implementation of The most efficient way to merge two lists in Java The original requirements are to: Identify the distinct values from two input files, and output the ...
user avatar
  • 96.7k
3 votes
2 answers
157 views

Toggling html buttons and text

I went through a question on SO, and optimized the code according to OP's requirements. I would like a review if it is done properly or not. Here is the code snippet, there are 2 level buttons, when ...
user avatar
  • 301
7 votes
1 answer
186 views

Project Euler #62 + Java 8 streams

(Inspired by this question) The digits of the cube, 41063625 (3453), can be permuted to produce two other cubes: 56623104 (3843) and 66430125 (4053). In fact, 41063625 is the smallest ...
user avatar
  • 19.1k
9 votes
1 answer
6k views

Highest pit - only climbing through the pit once

Problem description: A non-empty zero-indexed array A consisting of N integers is given. A pit in this array is any triplet of integers (P, Q, R) such that: 0 ≤ P < Q < R < N; ...
user avatar
7 votes
1 answer
407 views

Onion Run Festival (or the unexpected anagram for Union of Intervals)

Original question: Union of intervals In the original code, the Interval model class implements Comparable so that an input of <...
user avatar
  • 19.1k
19 votes
1 answer
352 views

Streaming Collatz

Challenge The recent question The 3n + 1 algorithm for a range inspired me to investigate a Java-8 dependent streaming mechanism for solving the programming challenge: For any two numbers ...
user avatar
  • 96.7k
20 votes
2 answers
5k views

Designing another Coffee Machine Application

After reading Designing a coffee machine yesterday, I decided I could also give the same problem a try. I have used the following problem statement (copied from the given question): Design a ...
user avatar
  • 10.6k
12 votes
2 answers
600 views

Finding a word within a pre-defined set using a search string with wildcards

The other day I was intrigued by this question (originally from here): Write a program that answers YES/NO search queries containing * placeholders. Example: if the data you have is (hazem, ahmed,...
user avatar
  • 107k
11 votes
1 answer
510 views

Let's Break Down the Party

This is a rags-to-riches question, the original is here: Coin dispenser program There are three parts to this, a Denomination ...
user avatar
  • 19.1k
2 votes
1 answer
5k views

Palindrome Checker with Stack

In my answer to this question, I wrote a new solution. Personally, I would not use a stack, but given that a stack was required, how good is this solution? In this solution, I add half of the word, ...
user avatar
12 votes
3 answers
4k views

The Beauty and the Strings

This originally appeared in Facebook's hacker cup 2013. Solving it was fun, though I find myself looping through similar data quite often. Challenge: Print the maximum beauty of strings. ...
user avatar
  • 9,779