Software Developer Interview Questions
- 4of 4 votes
AnswersGive a path get it's canonical form. So for example if you have path in the form e/../../a/d/./../b/c then you should return a/b/c.
I have the solution but it's not the most optimal or the best solution. I just wanted to see what others have.
- cyb March 09, 2015 in United Statespublic String canonicalPath(String path){ if(path == null || path.isEmpty()){ throw new RuntimeException("incorrect path provided"); } String[] chunks = path.split("/"); Stack<String> s = new Stack<String>(); List<String> arr = new ArrayList<String>(); for(String chunk: chunks){ if(chunk.isEmpty() || chunk == "."){ System.out.println("skipping"); }else{ if(!s.isEmpty() && s.peek().equals("..") && !chunk.equals("..")){ while (!s.isEmpty()) { if(s.peek().equals("..")){ s.pop(); }else{ s.pop(); break; } } s.push(chunk); }else{ s.push(chunk); } } } StringBuffer sb = new StringBuffer(); List<String> list = null; if(!s.isEmpty()){ list = new ArrayList<String>(s); } if(list != null){ for(String ss : list){ sb.append("/"+ss); } } return sb.toString(); }
| Report Duplicate | Flag | PURGE
Amazon Software Developer Data Structures - 0of 0 votes
AnswersSimple java code to print a character.the character should be printed according to users height and width.
- Poornima March 07, 2015 in India
ex:h=5,w=3| Report Duplicate | Flag | PURGE
xyz Software Developer Java - 1of 1 vote
Answerfind if the given set of elements 2,4,3 form a colorful number?
- joe sturridge March 05, 2015 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Developer Algorithm - 0of 0 votes
Answerfind if the given set of elements 2,4,3 form a colorful number?
- joe sturridge March 05, 2015 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Developer Algorithm - 0of 0 votes
AnswersIf jan 1 2011 is tuesday then what will be the name of the day for march 6 2064 and print that.
- joe sturridge March 05, 2015 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Developer Algorithm - -1of 1 vote
Answersconvert a 2d matrix in to a sprint order matrix and print it
- joe sturridge March 05, 2015 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Developer Object Oriented Design - 0of 0 votes
AnswersBalanced String
- albertchenyu March 04, 2015 in United States
Given a string that has{},[],() and characters.Check if the string is balanced. E.g. {a[(b)]} is balanced. {a[(b])} isunbalanced.| Report Duplicate | Flag | PURGE
Epic Systems Software Developer - 0of 0 votes
AnswersRGBCompare
- albertchenyu March 04, 2015 in United States
Given a string of RGB value (rr, gg, bb)which represents in hexadecimal. Compare if rr or gg or bb is the biggest, ortwo of those values are equal and larger than the third one, or three valuesare equal with each other.| Report Duplicate | Flag | PURGE
Epic Systems Software Developer - 0of 0 votes
AnswersWrite a program to print the below series:
- alregith March 03, 2015 in United States
1 11 21 1211 111221 312211 13112221 ....
Another example of the series:
12 1112 3112 132112 1113122112 ....
You will be given a number. You will have to print the first ten numbers in the series. The series is basically the number of occurrence followed by the number. The occurrence should be continuous.| Report Duplicate | Flag | PURGE
Epic Systems Software Developer - 0of 0 votes
AnswersFind the longest substring in a string that has no repeated character.
- 123456789 March 02, 2015 in United States| Report Duplicate | Flag | PURGE
Software Developer - 0of 0 votes
AnswersYou are given two strings. Find the edit distance between them. Edit distance is the minimum number of operations required to change one of the strings to the other. These operations are insert a character, delete a character, replace a character by another one.
- 123456789 March 02, 2015 in United States| Report Duplicate | Flag | PURGE
Software Developer - 0of 0 votes
AnswersYou are given a m*n grid of integers, where each number at position [i][j] is less than the numbers in [i+1][j] and [i][j+1]. For a number X, return its position in the grid (it's guaranteed that X exists in the grid).
- 123456789 March 02, 2015 in United States| Report Duplicate | Flag | PURGE
Software Developer - 2of 2 votes
AnswerThe problem gives you a sample input data file containing the all the employee-employer relationship information of a company. For example "Peter, John, 2013, software developer--John, NULL, 2012, CEO--David, Peter, 2014, technician..." means there are 3 people int this company (segmented by '--' ), the first 1 is Peter, his boss is John, he entered the company in 2013 as a software developer. The second is John as CEO, with no boss, the third is David as technician, his boss is Peter. The problem is asking to output information in hierarchy style
- dknguyen13 February 28, 2015 in United States| Report Duplicate | Flag | PURGE
unknown Software Developer Java - 0of 0 votes
AnswersRemove duplicates in an array of numbers. You can use a second array or the same array, as the output array. (I used a hash table to do this).
- sush February 27, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Developer Hash Table - 1of 1 vote
AnswersWrite a maxDepth function to find maximum depth of a binary tree. What is the time and space complexity of your function.
Given:
- naomi.lijing@googlemail.com February 27, 2015 in UKclass Tree { public Tree left; public Tree right; } int maxDepth(Tree head) {}
| Report Duplicate | Flag | PURGE
Bloomberg LP Software Developer - 0of 0 votes
AnswersGiven a string containing letter, digit, and other characters, write a function to check palindrome for only letter and digit. The implementation need to be in-place, no extra memory is allowed to create another string or array.
- naomi.lijing@googlemail.com February 25, 2015 in UK
For example:
"ABA" is palindrome
"A!#A" is palindrome
"A man, a plan, a canal, Panama!" is palindrome| Report Duplicate | Flag | PURGE
Facebook Software Developer - 0of 2 votes
AnswersGiven a certain range, produce all numbers in that range that fit the criteria. The criteria is as follows:
- blue60598 February 13, 2015 in United States
a number that starts with 2 of the same number, and then the sum of the previous 2 is that of the next number, and etc. For example:
112358, 121224, 448| Report Duplicate | Flag | PURGE
Epic Systems Software Developer Algorithm - 0of 0 votes
AnswersIf given a number find a number if it is colorful. A number is said to be colorful if all its possible unique permutations multiplication result different.
- chetan February 11, 2015 in United States
Eg: if n = 1234 then permutations are (1,2),(1,3),(1,4), (2,3),(2,4),(3,4),(1,2,3), (1,2,4), (2,3,4). That's it, no other combination. Find the multiplication of digits in each combination and if any of them repeats then number is not colorful.| Report Duplicate | Flag | PURGE
Epic Systems Software Developer Algorithm - 2of 2 votes
AnswersMutiplicative iteration.Assume letters are A=1,B=2....The number N=4 then A=1*4=4.If result is greater than 26 mod 26.Input a string and give a encrypted result as output.
- chutzpah February 11, 2015 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Developer - 0of 0 votes
AnswersWrite a function which takes an input for a double dimensional matrix.Each page is 1000 pixels wide and 1000 pixels high.A black pixel is represented by 1 and a white pixel by 0.Return an answer set of array of row numbers for appropriate page breaks.A page break would ideally be a row with all white pixels.If the page break is encountered more than 1000 rows from the last break then the page break should be forcefully taken 1000 rows from the last break.
- chutzpah February 11, 2015 in United States| Report Duplicate | Flag | PURGE
Epic Systems Software Developer - 1of 1 vote
AnswersWhy would you chose Java of C# to build your application?
- jenish.shah October 26, 2012 in United States| Report Duplicate | Flag | PURGE
Software Developer Software Development Manager Application / UI Design