Google Code Jam 2011: Round 1B Problem 1

Here’s a problem that appeared on Round 1B of Google’s Code Jam 2011 edition: Problem In the United States, 350 schools compete every year for an invitation to the NCAA College Basketball Tournament. With so many schools, how do you decide who should be invited? Most teams never play each other, and some teams have […]

Google Code Jam 2011: Round 1A Problem 1

In order to practice for the Round 1 of Google Code Jam 2012, which is coming in two weeks, I started solving the problems of the same round of last year’s edition. Below you’ll find the first one: The Problem I played D (D > 0) games of FreeCell today. Each game of FreeCell ends […]

Google Code Jam 2012: Qualification Problem 2

This problem was worth 20 points, and you needed to think about it a bit, but finding the answer wasn’t that difficult. The Problem You’re watching a show where Googlers (employees of Google) dance, and then each dancer is given a triplet of scores by three judges. Each triplet of scores consists of three integer […]

Amazon CodeNinja Programming Contest

This Saturday the Amazon CodeNinja Programming Contest is taking place. Here’s the first problem: GIven a 2D NxN matrix, visualize it as concentric circles. You have to find the rotated matrix where each element in the circle is rotated by 1 position layer by layer in an alternate clockwise and anticlockwise direction. Input Format: First […]

Basics of Combinations

First make sure to read the basics of permutations. So what’s the different between permutations and combinations? Suppose we have set A = {a,b,c,d,e}. A permutation of that set could be abc, and another permutation could be acb. In other words, a permutation is an arrangement of the objects of set A, where order matters. […]