Monthly Archives: June 2013

Transpose of a text file

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string path = @"C:\Users\saikatd\"; string[] lines = File.ReadAllLines(path + "input.txt"); int maxLength = lines.Max(x => x.Length); char[,] ch1 = … Continue reading

Posted in Information Technology | Leave a comment

Intersection of two integer arrays

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { //Intersection of two integer arrays int[] A = { 1, 2, 3, 4, 5, 6, 6, 7, 9, 4 … Continue reading

Posted in Information Technology | Leave a comment

Permutation with number of 1s greater than or equal to number of 0s

Given a binary array containing 0s and 1s, print all the permutations of a specified length such that for any index position the number of 1s encountered is always greater than or equal to the number of 0s encountered from … Continue reading

Posted in Information Technology | Leave a comment

Given a sequence of intervals, return the max overlapping interval

using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int[] intervalArray = { 5, 11, 6, 18, 2, 5, 3, 12 }; int[] startPosition = new int[intervalArray.Length / … Continue reading

Posted in Information Technology | Leave a comment