Monthly Archives: September 2012

Find the minimum distance between two specified characters in a given string

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Console.WriteLine(“Minimum distance = ” + GetMinimumDistance(“bbxaayybb”, ‘a’, ‘b’)); } public static int GetMinimumDistance(string str, char ch1, char ch2) { int distance … Continue reading

Posted in Information Technology | 1 Comment

Counting the number of valid bracket permutations for a given length

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { public static int flag = 0; static void Main(string[] args) { int numberOfCircles = 4; int stringLength = 2 * numberOfCircles; int counter = 0; string … Continue reading

Posted in Information Technology | 1 Comment

Prioritization of Test Cases

Risk of any test case failure is determined by two factors: 1. Probability: It’s the likelihood of the scenario happening in prod or how often or what percentage of customers might hit that scenario. The higher this likelihood, the higher … Continue reading

Posted in Information Technology | Leave a comment

Count the number of mkdir commands required

http://code.google.com/codejam/contest/635101/dashboard#s=p0 To create a directory, you can use the mkdir command. You specify a path, and then mkdir will create the directory described by that path, but only if the parent directory already exists. For example, if you wanted to … Continue reading

Posted in Information Technology | Leave a comment

Kisses & Hugs

Princess Artapoelc greeted her guests by either kissing on the cheek (K) or hugging (H). From the first guest she kisses, she has a compulsion to necessarily kiss every alternate guest from that first kissed guest. That is if the … Continue reading

Posted in Information Technology | Leave a comment

Match the rows

Count the number of line intersections while matching numbers across two rows. Assume that there won’t be a case wherein a line would intersect at more than two points. Examples: Number of intersections = 4 Number of intersections = 2 … Continue reading

Posted in Information Technology | Leave a comment

Grid Traversal

There is a rectangular grid of size m * n . Bob is in location ( x, y ) inside grid. He can move in 4 directions up, down, right and left. He will die if he steps outside of … Continue reading

Posted in Information Technology | Leave a comment