Epic Systems Interview Question for Software Engineer / Developers






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

public static void main(String[] args) throws IOException
{
print("Enter a number");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int i=0, min_even=Integer.MAX_VALUE, max_odd=Integer.MIN_VALUE;

while(true)
{
i = Integer.parseInt(br.readLine());

if(i==0)
break;

if(i%2 == 0)
{
if(i < min_even)
min_even = i;
}
else
{
if(i > max_odd)
max_odd = i;
}
}
print("The min even is: " + Integer.toString(min_even));
print("The max odd is: " + Integer.toString(max_odd));
}

- Anonymous November 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

try
{
int read = sc.nextInt()
}
catch( FormatException e )
{
println(e.message)
}
maxOdd = read
minEven = read
while( read != 0 )
{
if( read%2 != 0 && read > maxOdd )
maxOdd = read
if( read%2 == 0 && read < minEven )
minEven = read
}

- hyagriva July 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

<pre lang="java" line="1" title="CodeMonkey2687" class="run-this">/* The class name doesn't have to be Main, as long as the class is not public. */
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
String s;
while (!(s=r.readLine()).startsWith("42")) System.out.println(s);
}
}

int main( )
{
int nos[25], i=0, a, b, temp;
nos[0]=1;
for(i =0; i<= 25; i++)
{
cout<< "enter and integer: "<< endl;
cin>> nos[i];

if ( nos[i] == 0)
{
break;
}
else
continue;
}


for ( a= 0; a<= i; a++)
{
for(b=0; b<= i; b++)
{
if (nos[b]< nos[b+1])
{
temp = nos[b];
nos[b]= nos[b+1];
nos[b+1] = temp;
}
else
continue;
}
}
cout<< "Largest number entered by user" << nos[0]<<endl;
cout<<"smallest number"<< nos[i]<<endl
;


system("PAUSE");
return 0;
}
</pre><pre title="CodeMonkey2687" input="yes">
</pre>

- Anonymous September 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int main()
{
	int maxOdd = 0;
	int minEven = 10000000;
	string input;
	int intVal;

	while(true)
	{
		getline(cin,input);
		intVal = atoi(input.c_str());
		if(intVal != 0)
		{
			if(intVal%2 == 0)
			{
				if(intVal<minEven)
				minEven = intVal;
			}
			else if(intVal>maxOdd)
			{
				maxOdd = intVal;
			}
		}
	
		else if(intVal == 0)
		{
			cout<<"Terminating integer entered or invalid character...press any key to exit\n";
			break;
		}
		
	}
	cout<<"FTW Min Even = "<<minEven<<endl;
	cout<<"FTW Max Odd = "<<maxOdd<<endl;
		
	getchar();

}

- Joey September 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

There is no assumption that the input is set of integers, the above codes should take care of the float point numbers.(Simply ignore such numbers, but it's necessary)

- sanzoy October 06, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Non integer should be ignored.

For large number of inputs, it might be a better idea to follow the idea of parallel, and divide the input vector into sqrt(length of vector) groups.

- yp October 20, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

<pre lang="c++" line="1" title="CodeMonkey18158" class="run-this">#include <iostream>
#include <string>
#include <sstream>
#define N 64
using namespace std;

void main(){
int input[N];
cout<<"please input: "<<endl;
int i = 0;
while(cin>>input[i]){
if(input[i]==0) break;
i++;
}
int maxodd=input[0];
int mineven=input[i-1];
for(int k = 0; k <i-1;k++){
if(input[k]>maxodd&&input[k]%2==1) maxodd=input[k];
if(input[k]<mineven&&input[k]%2==0) mineven=input[k];
}
cout<<"max odd is: "<<maxodd<<" and min even is: "<<mineven<<endl;
system("pause");
}
</pre><pre title="CodeMonkey18158" input="yes">
</pre>

- Anonymous November 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void main(String[] args) throws IOException 
{
print("Enter a number");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int i=0, min_even=Integer.MAX_VALUE, max_odd=Integer.MIN_VALUE;

while(true)
{
i = Integer.parseInt(br.readLine());

if(i==0)
break;

if(i%2 == 0)
{
if(i < min_even)
min_even = i;
}
else
{
if(i > max_odd)
max_odd = i;
}
}
print("The min even is: " + Integer.toString(min_even));
print("The max odd is: " + Integer.toString(max_odd));
}

- Anonymous March 27, 2011 | 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