Category Archives: Challenges

Square Subsequences Problem

A reader asked if I could help him with the Square Subsequences problem on HackerRank. Basically you need to generate all subsequences of a given string (i.e., a powerset of the set of chars), count the number of subsequences that are square, and return this count. In the past I have already coded a powerset […]

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 […]

CodeSprint 2 Problem: Subsequence Weighting

Another problem from CodeSprint 2: A subsequence of a sequence is a sequence which is obtained by deleting zero or more elements from the sequence. You are given a sequence A in which every element is a pair of integers i.e A = [ (a1, w1) , (a2, w2) ,…,(aN, wN)]. For a subseqence B […]

CodeSprint 2 Problem: How Many Coin Tosses to Get N Heads?

I am participating in InterviewStreet’s CodeSprint this weekend. It’s basically a 48-hour coding competition. Some of the problems are quite interesting, and I’ll be talking about them here. The first one I tried had this description: You have an unbiased coin which you want to keep tossing until you get N consecutive heads. You’ve tossed […]

CodeSprint 2 Problem: Permutations

This problem appeared on the Code Sprint 2 competition by (check out my review here). Given n, print a permutation(p) of (0,1,2…n-1). From the permutation p, you can create n-1 (x,y) coordinates, where x and y are consecutive pairs in the permutation. You are also given the n x n square matrix V. For […]

CodeSprint 2 Problem: Picking Cards

This problem appeared on the Code Sprint 2 competition by (check out my review here). There are N cards on the table and each has a number between 0 and N. Let us denote the number on the ith card by ci. You want to pick up all the cards. The ith card can […]

Make Sure to Participate on the Next Code Sprint

This weekend I took part on Code Sprint 2, a programming competition organized by the folks at The whole contest was very well organized. What I liked was the fact that you could follow a live leaderboard with the rankings of all participants, and the problems were well structured and explained. They were pretty […]

Programming Challenges and Contests Online

I am noticing an interesting trend lately: there are a bunch of website emerging with the goal of connecting programmers and tech companies by using programming challenges and contests. Some that you might wanna check out: CodeEval InterviewStreet Code Chef Top Coder is probably the pioneer in this area, by those upcoming sites seem […]