Monthly Archives: November 2008

Telephone Words

using System;using System.Collections.Generic;using System.Text;using System.IO; namespace Telephone{    class Telephone    {        static void Main(string[] args)        {            try            {                Console.Write("Enter a telephone number: ");                string phoneNumber = Console.ReadLine();                //creating a jagged array for digit matrix                char[][] digitMatrix = new char[phoneNumber.Length][];                //initializing the … Continue reading

Posted in Information Technology | Leave a comment

Combinations of a String

Implement a function that prints all possible combinations of the characters in a string. These combinations range in length from one to the length of the string. Two combinations that differ only in ordering of their characters are the same … Continue reading

Posted in Information Technology | Leave a comment

Permutations of a String

Implement a routine that prints all possible orderings of the characters in a string. In other words, print all permutations that use all the characters from the original string. For example, given the string “hat”, your function should print the … Continue reading

Posted in Information Technology | Leave a comment

Find the first nonrepeated character in a word

using System;using System.Collections.Generic;using System.Text; namespace Mono{    class Mono    {        static void Main(string[] args)        {            try            {                //Code to find the first nonrepeated character in a word                Console.Write("Enter a word to test: ");                string str = Console.ReadLine();                int flag = 0;                … Continue reading

Posted in Information Technology | Leave a comment

Count Open Lockers

Problem: Suppose you are in a hallway lined with 100 closed lockers. You begin by opening all 100 lockers. Next, you close every second locker. Then you go to every third locker and close it if it is open or … Continue reading

Posted in Information Technology | Leave a comment