Tag Archives: Short Code

2-Look OLL Flashcards

I recently got into Rubik’s cubes using the beginner’s method (thank you badmephisto for the tutorial). Then I started learning learning F2L so I could complete the middle layers quicker. But while F2L is more intuitive, solving the last layer is more algorithmic.

I want to use 4LLL to solve the last layer because I’d “only” have to learn about 16 algorithms compared to the 78 algorithms for 2LLL. But it takes time to solve the cube to the point where I would need to use one of the algorithms I’m trying to memorize. So I wanted to just study the algorithms themselves, flashcard style. To do that I made a simple page.

The page isn’t anything special. Just some JavaScript/jQuery that randomly picks an algorithm from an array that’s hard-coded into the JavaScript and displays its information on the page. There’s no back-end to it or anything. It’s been a while since I posted a blog entry so I figured I’d upload the page to my site and make a post about it.

The page itself is here, and I made a GitHub repo for the page (not sure why) here.

Following Directions (repeatedly)


I found a web page containing some JavaScript I made late last year while cleaning the icons off of my desktop. I’m not sure exactly what inspired me to make it. The page I made said it follows the principle of “three rights make a left”. So maybe I got the idea when I missed a turn while driving.

The application is very simple, and in fact reminds me of a very limited type of Turtle Graphics.

Continue reading Following Directions (repeatedly)

Matching braces in a string

I heard recently about an interview problem involving matching braces in a string. Checking to see if all the braces in a string are paired up in the proper order. Seemed like an interesting, and short, challenge.

Examples of strings with proper brace matching: "()", "(){}[]", "([{}])"

Examples of strings without proper brace matching: "(", "[]]", "([)]"

Continue reading Matching braces in a string

Converting minutes into a readable string

I’d like to start posting some shorter entries. Hopefully that will be more conducive to making posts more often. I’m going to start tagging these as Short Code entries.

For this first one I came across a challenge on reddit about converting a quantity of minutes into a readable string, paraphrasing here:

Write a function that takes in a number of minutes as an integer and returns a string of the format “# years, # months, # days, # hours, #minutes”.

Continue reading Converting minutes into a readable string