## Epic Systems Interview Questions

- 0of 2 votes
N*N matrix is given with input red or black. You can move horizontally, vertically or diagonally. If 3 consecutive same color found, that color will get 1 point. So if 4 red are vertically then point is 2. Find the winner.

- 0of 0 votes
Find the presence of a given word in a given grid, word can be matched in any direction up-down, down-up, left-right, right-left, both diagonals up and down etc.

- 1of 3 votes
Print all palindromes of size greater than equal to 3 of a given string. (DP)

- 1of 1 vote
Given n. Generate all numbers with number of digits equal to n, such that the digit to the right is greater than the left digit (ai+1 > ai). E.g. if n=3 (123,124,125,……129,234,…..789)

- -6of 6 votes
This code is written in vb.net language for XO game between two players , TIC TOE

I WANT A LITTLE EXPLANATION FOR EACH MAIN LINE IN THE CODE ..

Here is the cod>>

>

>

Public Class Form1

Dim player1, player2 As String

Dim CurrPlayer As Char

Dim winner As Char

Dim win As Boolean = False

Dim Endgame As Boolean = False

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

CurrPlayer = "O"

player1 = InputBox("First Player Name:")

player2 = InputBox("Second Player Name:")

lblPlayer1.Text = lblPlayer1.Text + player1

lblPlayer2.Text = lblPlayer2.Text + player2

End Sub

Public Function turn() As Char

If CurrPlayer = "X" Then

CurrPlayer = "O"

ElseIf CurrPlayer = "O" Then

CurrPlayer = "X"

End If

Return CurrPlayer

End Function

Public Function CheckWin() As Boolean

If btn1.Text <> "" And btn1.Text = btn2.Text And btn2.Text = btn3.Text Then

winner = CurrPlayer

win = True

ElseIf btn1.Text <> "" And btn1.Text = btn5.Text And btn5.Text = btn9.Text Then

winner = CurrPlayer

win = True

ElseIf btn1.Text <> "" And btn1.Text = btn4.Text And btn4.Text = btn7.Text Then

winner = CurrPlayer

win = True

ElseIf btn2.Text <> "" And btn2.Text = btn5.Text And btn5.Text = btn8.Text Then

winner = CurrPlayer

win = True

ElseIf btn3.Text <> "" And btn3.Text = btn5.Text And btn5.Text = btn7.Text Then

winner = CurrPlayer

win = True

ElseIf btn3.Text <> "" And btn3.Text = btn6.Text And btn6.Text = btn9.Text Then

winner = CurrPlayer

win = True

ElseIf btn4.Text <> "" And btn4.Text = btn5.Text And btn5.Text = btn6.Text Then

winner = CurrPlayer

win = True

ElseIf btn7.Text <> "" And btn7.Text = btn8.Text And btn8.Text = btn9.Text Then

winner = CurrPlayer

win = True

End If

Return win

End Function

Public Sub newGame()

For Each c As Control In Me.Controls

If c.GetType Is GetType(Button) Then

c.Text = ""

End If

Next

CurrPlayer = "O"

win = False

End Sub

Public Sub displayWinner()

If CheckWin() Then

If CurrPlayer = "X" Then

MessageBox.Show("Congratulations, the winner is " + player1, "Congratulations", MessageBoxButtons.OK, MessageBoxIcon.Information)

newGame()

Else

MessageBox.Show("Congratulations, the winner is " + player2, "Congratulations", MessageBoxButtons.OK, MessageBoxIcon.Information)

newGame()

End If

End If

End Sub

Public Sub CheckEven()

Dim empty As Boolean = False

For Each c As Control In Me.Controls

If c.GetType Is GetType(Button) Then

If c.Text = "" Then

empty = True

End If

End If

Next

If empty <> True Then

MessageBox.Show("Players are Even", "Neutral Game", MessageBoxButtons.OK, MessageBoxIcon.Information)

newGame()

End If

End Sub

Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click

If btn1.Text = "" Then

btn1.Text = turn()

displayWinner()

CheckEven()

End If

End Sub

Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click

If btn2.Text = "" Then

btn2.Text = turn()

displayWinner()

CheckEven()

End If

End Sub

Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click

If btn3.Text = "" Then

btn3.Text = turn()

displayWinner()

CheckEven()

End If

End Sub

Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click

If btn4.Text = "" Then

btn4.Text = turn()

displayWinner()

CheckEven()

End If

End Sub

Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click

If btn5.Text = "" Then

btn5.Text = turn()

displayWinner()

CheckEven()

End If

End Sub

Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click

If btn6.Text = "" Then

btn6.Text = turn()

displayWinner()

End If

End Sub

Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click

If btn7.Text = "" Then

btn7.Text = turn()

displayWinner()

CheckEven()

End If

End Sub

Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click

If btn8.Text = "" Then

btn8.Text = turn()

displayWinner()

CheckEven()

End If

End Sub

Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click

If btn9.Text = "" Then

btn9.Text = turn()

displayWinner()

CheckEven()

End If

End Sub

End Class

- 0of 0 votes
You can swap only two consecutive elements. You have to show all steps to convert a string into another string (both strings will be anagrams of each other). E.g. GUM to MUG

GUM

GMU

MGU

MUG

- 2of 2 votes
In 1-9 keypad one key is not working. If some one enters a password then not working key will not be entered. You have given expected password and entered password. Check that entered password is valid or not

Ex: entered 164, expected 18684 (you need to take care as when u enter 18684 and 164 only both will be taken as 164 input)

- 1of 1 vote
If an N X N matrix is given, print it in spiral order.

Example: Below is 5 X 5 matrix

i l o v e

d i n t e

n i e e p

a v w r i

m a x e c

Print in spiral order. Output is iloveepicexamandinterview

- -5of 5 votes
n*n matrix, find the longest ways for each players.

players: red and blue.

players can jump to the next position based on the opposite player, after jump, remove the opposite player.

- 0of 0 votes
An updated tic tac toe game: n*n matrix, two users: X and O. If 3 respective marks together(no mater: vertical, horizontal, diagonal ) will win 1 point; For user X, 6 respective marks together will win 3 points; For user O, 8 respective marks together will win 6 points, check who win.

- -8of 8 votes
rints the highest possible numberthat a user can print.

- 1of 1 vote
Length is given as input.Print all possible permutations of numbers between 0-9.

Eg: if input length=4

all possible combinations can be 0123, 1234, 5678,9864,...etc all combinations of length from in all numbers between 0-9

- 2of 2 votes
Implement LookAndSay function. For example, first, let user input a number, say 1. Then, the function will generate the next 10 numbers which satisfy this condition:

1, 11,21,1211,111221,312211...

explanation: first number 1, second number is one 1, so 11. Third number is two 1(previous number), so 21. next number one 2 one 1, so 1211 and so on...

- -6of 6 votes
2.write a program to diaplay the advisered average for the list of numbers my omitting the largest number in the series.

eg :3,6,12,55,289,600,534,900 and 172.

avg=(3+6+12+55+289+172) /6and eliminating 534,900,600

- 1of 1 vote
1.Substring Addition

Write a program to add the substring

eg :say you have a list {1 7 6 3 5 8 9 } and user is entering a sum 16.Output should display (2-4) that is {7 6 3} cause 7+6+3=16.

- 2of 2 votes
Print all valid phone numbers of length n subject to following constraints:

1.If a number contains a 4, it should start with 4

2.No two consecutive digits can be same

3.Three digits (e.g. 7,2,9) will be entirely disallowed, take as input

- 0of 0 votes
You are given a grid of numbers. A snake sequence is made up of adjacent numbers such that for each number, the number on the right or the number below it is +1 or -1 its value. For example,

1 3 2 6 8

-9 7 1 -1 2

1 5 0 1 9

In this grid, (3, 2, 1, 0, 1) is a snake sequence.

Given a grid, find the longest snake sequences and their lengths (so there can be multiple snake sequences with the maximum length).

- 1of 1 vote
find longest increasing sub sequence in 2d array.

(bit more expl..)

ex: finding length of the snake in snake game

---------

the sequence must not be diagonally.

but it can be any like top-bootm,bottom-left-top ........

increasing means one step

ex: 10,11,12,13 (correct)

12,14,15,20(wrong)

Ex: input: consider 4x4 grid

2 3 4 5

4 5 10 11

20 6 9 12

6 7 8 40

output : 4 5 6 7 8 9 10 11 12

- 0of 0 votes
if apple is for 40 cents, banana is for 60 cents and grapefruit is for 80 cents then what pear is for???

- 0of 0 votes
Again part of "coding" test for non-programmers

What number is non-standard if standard means all integers.

Answers included 99, -0. 11.2, and -16. Unsure if -0 is an integer. No answer was an option as well.

Edit: that non-standard was not in the original question. I do not recall the question exactly, but it revolved around whether -0 is an integer.

- -1of 1 vote
A program removes all non-numeric characters until it reaches a second non-numeric and then stops. "+3.4"=3

What would result when "1.2" was entered?

1 was not an option. 1.2 was not.

No answer was an option. Chose no answer.

I did pass the test with many "no answers".

- 0of 0 votes
Which is a true statement?

if both true, A&B=True

A&B=False if only one false

A^B=True if only one True

Which of these 5 is not true? The all seemed fairly obvious except

1) A&B^C

2) 8&0+0=0

3 others I forgot

One was a math problem without an =

the challenge was not the logic but whether

one can classify an equation with 0=0 or answer 8 as

true or false.

No answer was available.

Updated

- 0of 0 votes
What is the remainder of normal fraction?

# = Modulo

Several problems used the # symbol defined as

the remainder 4 / 3 =1

One question asked 3 /4 another 1/2

another had 0/0

You had to know not only modulo but whether it

is usable for a normal fraction.

Please update if you take the test

update

- 0of 0 votes
Part of coding test for non-programmers.

‘ means not. It converts a character to null in a string but converts the character to 0 in an operation

1=John 2= Jane 3= Does

“’123” = ?

Jane3Does was the closest answer. It seemed wrong because of the 3 in there.

I'm sorry i forgot the other answers, but they were

equally illogical.

- 1of 1 vote
‘ means not. It converts a character to null in a string but converts the character to 0 in an operation

‘5 means null whereas ‘5+1=1

Which one of these is true?

Cannot recall the options; they all appeared false.

I put the last option, but couldn’t figure it out.

‘(‘5)=0?

- 0of 0 votes
Part of coding test for non-programmers.

Holy Water is concatenated by “Holy “.”Water” or “Holy”.” Water” Watch the space.

How would you spell "Holy water" given “Holy”=God and HOH=”Water”.

1) God.HOH

2) God.” “.HOH

3) God”.” HOH

4) Forgot others

- 0of 0 votes
Dynamic programming problem: Coin change problem: Find the minimum number of coins required to make change for a given sum (given unlimited cumber of N different denominations coin)

- 0of 0 votes
Written round question for Epic systems. They asked two dynamic programming problems.

Write a dynamic programming solution for finding maximum contiguous sub-sequence sum.

- 0of 0 votes
User inputs a series of numbers and terminates the series by a zero. Your program should find the first three maximum values in the series and exclude them from the series and compute the average of the remaining numbers. (excluding zero as well)

Ex - 3, 7, 12, 2, 25, 8, 9, 13, 10, 0

First three maximum numbers = 25, 13, 12

Average of the rest = (3 + 7 + 2 + 8 + 9 + 10) / 6 = 6.5

- 2of 2 votes
User inputs a sequence of digits. Every digit is a keystroke, that is equivalent to some character out of a sequence of characters. Digit zero and five mean NULL. The table is given below

0 - NULL

1 - v, t, f, r, q

2 - f, t, k

3 - w, z, b, g

4 - r, s

5 - NULL

6 - f, i, r

7 - p

8 - l, o

9 - p

Generate all possible character sequence for a given sequence of digits.

Ex - If the user input 9801, your program should generate

{plv, plt, plf, plr, plq, pov, pot, pof, por, poq} (not necessarily in this order).

This problem is somewhat similar to the SMS problem. It basically boils down to generating a cartesian product of the character sets corresponding to keys.