Epic Systems Interview Question for Software Developers


Country: United States




Comment hidden because of low score. Click to expand.
1
of 1 vote

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace series
{
class Program
{
static void Main(string[] args)
{
Int64 num = 12;
string strOut = num.ToString();
for(int i = 0; i < 10; i++)
{
Console.Write(strOut + " ");
strOut = PrintSeries(num);
Int64.TryParse(strOut,out num);
}
//PrintSeries(1);
Console.Read();
}
static string PrintSeries(Int64 num)
{
string temp, strOut = string.Empty;
int count = 1;
temp = num.ToString();
char prev = temp[0];
int length = temp.Length;
for (int i = 1; i < length; i++)
{
if (temp[i] == prev)
{
count++;
}
else if (temp[i] != prev)
{
strOut = strOut + count.ToString() + prev.ToString();
count = 1;
prev = temp[i];
}
if (i + 1 == length)
{
strOut = strOut + count.ToString() + prev.ToString();
count = 1;
prev = temp[i];
}
}
if (length == 1)
{
strOut = count.ToString() + temp;
}
return strOut;
}
}
}

- ts.bharath March 05, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

std::string NextInSeries(std::string cur) 
{
   std::string rval;
   int j;
   for (int i = 0; i < cur.size(); i = j)
   {
      for(j = i+1; cur[j] == cur[i]; j++);
      rval += '0'+j-i; 
      rval += cur[i];
   }
   return rval;
}

void main()
{
   while (1)
   {
      std::string cur; std::cin >> cur;
      for (int i = 0; i < 10; i++)
      {
         cur = NextInSeries(cur);
         std::cout << cur << "\n";
      }
   }
}

- tjcbs2 March 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void PrintSeries(int n)
{
	string N = n.ToString();

	for(int i = 0; i < 10; i++)
	{
		
		char prev = N[0];
		int count = 1;
		StringBuilder sb = new StringBuilder();
		for(int i = 1; i < N.Length; i++)
		{
			char c = N[i]
			if( c != prev)
			{
				sb.Append(count.ToString() + prev);
				prev = c;
				count = 1;
			}
			else
			{
				count++;
			}
		}

		// Doing final append of the last values
		sb.Append(count.ToString + prev);

		Console.WriteLine(sb.ToString());
	}
}

- Nelson Perez March 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

C# code:

class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("give a number");
            string num=Console.ReadLine();
            PrintSeries(num);
            Console.ReadKey();
        }

        public static void PrintSeries(string num)
        {
            string concatString = num;
            while(concatString.Length <10)
            {
            concatString = ContinousSeries(concatString);
            Console.WriteLine(concatString);
            }
        }
        public static string ContinousSeries(string num)
        {
            string concatString=null;
            int count=1;
            int i;
            if (num.Length == 1)
            {
                concatString = count + num;
            }
            else
            {
                for (i = 0; i < num.Length - 1; i++)
                {
                    if (num[i] == num[i + 1])
                    {
                        count++;
                    }
                    else
                    {
                        concatString = concatString + count.ToString();
                        concatString = concatString + num[i].ToString();
                        count = 1;
                    }
                    if ((i + 1) == num.Length - 1)
                    {
                        concatString = concatString + count.ToString();
                        concatString = concatString + num[i + 1].ToString();
                    }
                }
            }
             return concatString;
        }
}

- Anonymous March 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("give a number");
            string num=Console.ReadLine();
            PrintSeries(num);
            Console.ReadKey();
        }

        public static void PrintSeries(string num)
        {
            string concatString = num;
            while(concatString.Length <10)
            {
            concatString = ContinousSeries(concatString);
            Console.WriteLine(concatString);
            }
        }
        public static string ContinousSeries(string num)
        {
            string concatString=null;
            int count=1;
            int i;
            if (num.Length == 1)
            {
                concatString = count + num;
            }
            else
            {
                for (i = 0; i < num.Length - 1; i++)
                {
                    if (num[i] == num[i + 1])
                    {
                        count++;
                    }
                    else
                    {
                        concatString = concatString + count.ToString();
                        concatString = concatString + num[i].ToString();
                        count = 1;
                    }
                    if ((i + 1) == num.Length - 1)
                    {
                        concatString = concatString + count.ToString();
                        concatString = concatString + num[i + 1].ToString();
                    }
                }
            }
             return concatString;
        }

}}

- Arpit March 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

package com.company.epic;

public class Question3 {
	static String next(String n) {
		String nStringFormat = n + "";
		char previousDigit = nStringFormat.charAt(0), currentDigit = ' ';
		int noOfOccurences = 1;
		String nextNumber = "";
		for (int last = 1; last < nStringFormat.length(); last++) {
			currentDigit = nStringFormat.charAt(last);
			if (currentDigit != previousDigit) {
				nextNumber = nextNumber + noOfOccurences + "" + previousDigit;
				previousDigit = currentDigit;
				noOfOccurences = 1;
			} else {
				noOfOccurences++;
			}
		}
		nextNumber = nextNumber + noOfOccurences + previousDigit;
		return nextNumber;
	}

	public static void main(String[] args) {
		String nextNumber = "22111";
		for (int i = 0; i < 10; i++) {
			System.out.print(nextNumber + " ");
			nextNumber = next(nextNumber);
		}
	}
}

- srinivas March 04, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class CountSeries {
public static void main(String[] args) {
print("12");
}

public static void print(String initialNum) {

int i = 0;

StringBuffer str = new StringBuffer(initialNum);
System.out.println(str);
String temp = initialNum;
while (i < 10) {

temp = str.toString().trim();
str = new StringBuffer();

int curr = 0;
int previous = Integer.parseInt(Character.toString(temp.charAt(0)));
int count = 1;
for (int x = 1; x < temp.length(); x++) {

curr = Integer.parseInt(Character.toString(temp.charAt(x)));
if (curr != 0) {
if (curr == previous) {
count++;

} else {
str.append(count).append(previous);
count = 1;

}
previous = curr;
}
}

str.append(count).append(previous);
System.out.println(str);
i++;
}

}

}

- Tushar March 04, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace series
{
class Program
{
static void Main(string[] args)
{
Int64 num = 12;
string strOut = num.ToString();
for(int i = 0; i < 10; i++)
{
Console.Write(strOut + " ");
strOut = PrintSeries(num);
Int64.TryParse(strOut,out num);
}
//PrintSeries(1);
Console.Read();
}
static string PrintSeries(Int64 num)
{
string temp, strOut = string.Empty;
int count = 1;
temp = num.ToString();
char prev = temp[0];
int length = temp.Length;
for (int i = 1; i < length; i++)
{
if (temp[i] == prev)
{
count++;
}
else if (temp[i] != prev)
{
strOut = strOut + count.ToString() + prev.ToString();
count = 1;
prev = temp[i];
}
if (i + 1 == length)
{
strOut = strOut + count.ToString() + prev.ToString();
count = 1;
prev = temp[i];
}
}
if (length == 1)
{
strOut = count.ToString() + temp;
}
return strOut;
}
}
}

- ts.bharath March 05, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

package epic;

public class LookSay {
	public static void main(String arg[]) {
		int num = 12;
		printSeries(new Integer(num).toString(), 1);
	}
	
	static void printSeries(String num, int limit) {
		if(limit == 10) {
			System.exit(0);
		}
		if(limit == 1) {
			System.out.print(num);
		}
		StringBuffer newNumStr = new StringBuffer("");
		for(int i=0; i<num.length();) {
			int count = 1;
			char current = num.charAt(i);
			i++;
			while (i < num.length() && current == num.charAt(i)) {
				i++;
				count++;
			}
			newNumStr.append(count).append(current);
		}
		System.out.print(" " + newNumStr);
		printSeries(newNumStr.toString(), ++limit);
	}
}

- Neo March 06, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class P24 {

	private static void print(String start, int n) {

		for (int i = 2; i < n; i++) {
			StringBuilder newString = new StringBuilder();
			int j = 0;
			while (j < start.length()) {
				char c = start.charAt(j);
				int count = 0;
				while (j < start.length() && start.charAt(j) == c) {
					count++;
					j++;
				}
				newString.append(count + "" + c);
			}
			System.out.println(newString);
			start = newString.toString();
		}
	}

	public static void main(String[] args) {
		print("1", 10);
	}
}

- eng.mohamed.CSD2014 July 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

package com.company.epic;

public class Question3 {
	static String next(String n) {
		String nStringFormat = n + "";
		char previousDigit = nStringFormat.charAt(0), currentDigit = ' ';
		int noOfOccurences = 1;
		String nextNumber = "";
		for (int last = 1; last < nStringFormat.length(); last++) {
			currentDigit = nStringFormat.charAt(last);
			if (currentDigit != previousDigit) {
				nextNumber = nextNumber + noOfOccurences + "" + previousDigit;
				previousDigit = currentDigit;
				noOfOccurences = 1;
			} else {
				noOfOccurences++;
			}
		}
		nextNumber = nextNumber + noOfOccurences + previousDigit;
		return nextNumber;
	}

	public static void main(String[] args) {
		String nextNumber = "22111";
		for (int i = 0; i < 10; i++) {
			System.out.print(nextNumber + " ");
			nextNumber = next(nextNumber);
		}
	}
}

- cnu1438 March 04, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More