Top Coder – Identifying Wood

Top Coder – Identifying Wood We call a pair of Strings (s, t) “wood” if t is contained in s as a subsequence. (See Notes for a formal definition.) Given Strings s and t, return the String “Yep, it’s wood.” (quotes for clarity) if the pair (s, t) is wood and “Nope.” otherwise. Notes – […]

Angular Controller with Sugar (controller as syntax)

An example of using the controller as syntax with Angular controllers as opposed to attaching everything to $scope. John Papa’s article is much more detailed than I can ever be as to all of the reasons it’s better to use the ‘with sugar’ method. – With or Without Sugar?. Another technique in this example is […]

Top Coder – Electronic Pet

Top Coder – Electronic Pet (Easy) Kirino has found a game in which she has to feed electronic pets. There are two pets in the game. You are given six ints st1,p1,t1,st2,p2,t2. To win the game, Kirino must satisfy the following rules: She must feed her first pet for the first time precisely at the […]

Top Coder – Bacteries Colony

Top Coder – BacteriesColony Solution in JavaScript Problem Grazyna works in a laboratory. Her team is about to perform an experiment with special bacteria. There is a row of vessels. Each vessel contains a colony of bacteria. The colonies may currently have different sizes. Namely, for each valid i there are currently colonies[i] bacteria in […]

Top Coder – DoubleLetter

Top Coder – Double Letter You are given a String S. You can modify this string by repeating the following process: Find the leftmost occurrence of two consecutive letters in S that are the same. If you found a pair of identical letters in the first step, delete those two letters from S. For example, […]

Top Coder – Forgetful Addition

Problem Top Coder – Forgetful Addition Alice had two positive integers, a and b. She typed the expression “a+b” into her computer, but the ‘+’ key malfunctioned. For example, instead of “128+9” the computer’s screen now shows “1289”. Later, Bob saw the string on the screen. He knows that the ‘+’ sign is missing but […]

Top Coder – Alice Game Easy

Top Coder – Alice Game Easy in JavaScript The problem: Top Coder – Alice Game Easy Alice and Kirito just played a game. The game consisted of a finite (possibly empty) sequence of turns. You do not know the exact number of turns. The turns were numbered starting from 1. In each turn, exactly one […]

Angular Directives

Often times my biggest problem with software development is being able to communicate with other developers because it turns out we are calling the same thing different names, or using the same name to talk about different things. This is most often felt during technical assessments when interviewing for a new job. One of the […]

Galleria jQuery plugin – enable swipe and lightbox

Lightbox works alone, swipe works alone, but together I was only getting the swipe functionality to work on a touch screen. Galleria.configure({ lightbox: true, swipe: 'auto' }); Seems like that should work right? swipe: auto is the default by the way. I just put it there for demonstration purposes. When on a touch device (it […]

CSS3 Gradient Generator

I use this tool all the time to create css gradients, but yesterday I came across something that I hadn’t noticed before that makes it even more awesome. The ability to upload an image. I took this image that I cut from a PSD and imported it: and it came up with about 30 points […]