Epic Systems Interview Question for Software Developers


Country: United States
Interview Type: Written Test




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

1- Convert the text to Upper case
2- 'A' Char value in ASCII is 65, subtract 64 and you get your 1 ('B' = 66 , 66 - 2 = 64)

Here is the code

public static void encryption(string text, int n)
        {
            text = text.ToUpper();
            int temp;
            foreach (char x in text)
            {
                temp = (((int)x - 64) * n) % 26;
                Console.WriteLine(temp);
            }
        }

- Ajloun February 15, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think we need to encrypt only upper case letters only. You are encrypting each and every character in string. A'm i right?

- xx April 03, 2015 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

public static String encryption(String s, int n){
s=s.toUpperCase();
String result="";
for(int i=0;i<s.length();i++){
result+=(s.charAt(i)-'A'+1)*n%26;
}
return result;
}

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

String getEncryptedString(String s, int n) {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            result.append((char) (((s.charAt(i) - 'a' + 1) * n - 1) % 26 + 'a'));
        }
        return result.toString();
    }

- Darya February 15, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Python version

def encrypt(aString):
	string = aString.lower()
	dict = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16,
	'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
	alphabet = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
	result = ''
	for i in range(len(string)):
		temp = dict[string[i]] * 4 			
		result += alphabet[(temp % 26) - 1]
	return result

- Terry February 19, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static String multiplicative(String message, int number) {

		String encrypted = "";
		int letterValue;
		for (int i = 0; i < message.length(); i++) {
			// ascii 'a' starts at decimal value 97, b = 98, c = 99, etc
			letterValue = (message.charAt(i) - 96) * number;
			while (letterValue > 25) {
				letterValue = letterValue % 26;
			}
			encrypted += (char) (letterValue + 96);
		}
		System.out.println(encrypted);
		return encrypted;
	}

}

- Jeremy Gilreath February 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static String encryption(String s, int n){
s=s.toUpperCase();
String result="";
for(int i=0;i<s.length();i++){
result+=(s.charAt(i)-'A'+1)*n%26;
}
return result;
}

- olivia February 21, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

c++ sol

#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

string encryp(const string &s, int n){
	string result{};
	transform(s.cbegin(),s.cend(),back_inserter(result),[&](char c){
		return char((((c-'A'+1)*n%26)+'A'-1));
		});
	return result;
}

int main(){
	string s("BOYU");
	cout<<encryp(s,6)<<endl;
}

- boyu7ni February 25, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can anybody explain the meaning of the question? I'm kind of confused.

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

Can anybody explain the meaning of the question? I'm kind of confused.

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

public class encript {
	
	
	public static void main(String[] arg){
	String str = "aTce";
	
	str = str.toUpperCase();
	int n = 4;
	
	
	for(int i=0; i<str.length(); i++)
	{
		int val = str.charAt(i) - 64;
		val = val*n - 1;
		if(val>26)
		{
			val = val%26;
		}
		char c = (char)(val+'a');
		System.out.print(c);
	}
	}

}

- nahidcse05 June 05, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

import java.util.*;
public class Encryption {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		HashMap mp=new HashMap();
		mp.put('a', 1); mp.put('b', 2); mp.put('c', 3); mp.put('d', 4); mp.put('e', 5); mp.put('f', 6); mp.put('g', 7);
		mp.put('h', 8); mp.put('i', 9); mp.put('j', 10); mp.put('k', 11);  mp.put('l', 12); mp.put('m', 13); mp.put('n', 14);
		mp.put('o', 15); mp.put('p', 16); mp.put('q', 17); mp.put('r', 18); mp.put('s', 19); mp.put('t', 20);
		mp.put('u', 21); mp.put('v', 22); mp.put('w', 23);mp.put('x', 24); mp.put('y', 25);mp.put('z', 26);
		
		char[] alphabets={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
		String str="SANTHOSH";
		str=str.toLowerCase();
		String output=null;
		int temp;
		for(int i=0;i<str.length();i++){
			temp=(Integer) mp.get(str.charAt(i)) * 4;
			if(temp>26){
				temp=temp%26;
			}
			if(output==null){
				output=Character.toString(alphabets[temp-1]);				
			}
			else
			{
				output+=Character.toString(alphabets[temp-1]);	
			}
			
		}
		System.out.println("\n"+output);

	}

}

- Sam February 12, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

No need of hashmap. simply do alphabets[ str.charAt(i) - 'a' ]

- ankitsharma13 March 06, 2015 | Flag


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