Find jobs for senior lead software engineer

Senior lead software engineer Interview Questions

265

Senior Lead Software Engineer interview questions shared by candidates

Top Interview Questions

Sort: Relevance|Popular|Date
Applied Materials
Java Senior Software Engineer/Lead Position was asked...14 October 2017

Input is a string like "AAAAABBCCAA" and it should print "5A2B2C2A". 5 being the continuous number of occurance for character 'A'. Same is with other characters also.

3 Answers

let string:String = "AAAAABBBVVVCVCAA" let characters = Array(string) var counter:Int = 1 var newArray:[String] = [String]() let lastCount = characters.count - 1 for count in 0...(characters.count - 2) { if characters[count] == characters[count + 1] { counter = counter + 1; }else { newArray.append("\(counter)\(characters[count])") counter = 1 } if lastCount == count + 1 { newArray.append("\(counter)\(characters[count])") } } print(newArray) Less

public static void main(String[] args) { String s = "AAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBCC"; Set set = new HashSet(); char b = 0; int count = 1; String newString = ""; for (int i = 0; i 0) { b = s.charAt(i - 1); } char c = s.charAt(i); if (!set.add(c)) { count++; } else { if (b != 0) { newString = newString + b + count; count = 1; } } } newString = newString + b + count; System.out.println(newString); } Less

public static void main(String[] args) { String s = "AAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBCC"; Set set = new HashSet(); char b = 0; int count = 1; String newString = ""; for (int i = 0; i 0) { b = s.charAt(i - 1); } char c = s.charAt(i); if (!set.add(c)) { count++; } else { if (b != 0) { newString = newString + b + count; count = 1; } } } newString = newString + b + count; System.out.println(newString); } Less

EPAM Systems

What if we insert with key null to a HashMap?

2 Answers

Didn't know, however, it's a very edge case, you can insert and the hashcode will be 0, so it's identifying the '0' bucket. Less

HashMap allows null as both key and value, as well. So you can associate a value to null key. However, TreeMap throws a NullPointerException if you try to put a key with null value. Less

Clean Power Research

1) Given a point and an collection of arbitrary 2D points, find the point closest to the the given point. 2) Given a collection of arbitrary 2D points, find the point closest to the median.

2 Answers

Nailed the first question - did it almost almost at typing speed. I looped through the points, calculated the distance, compared against my previously cached closest point & if the new one was closer cached it instead. Interviewer said that the proper answer was to keep the distances in a list, then sort the list - which is actually slightly less efficient than my answer. But the second question was just bizarre. The median of a collection of scalars is easy - and yes, sorting a list will help. But the median of a collection of 2D points is "distinctly non-trivial" as my calculus prof would say. I started on an answer anyway, and got to a sticky point when the interviewer said, "I have to think about this one some more" (He should have thought about more it before hand.) Less

Seems like the target point would be the midpoint of the x component range and then the y component values, then follow your first algo to find the point closest to that. Less

WhizAI

1) Update the existing map without creating another map. 2) Write code to show the deadlock. 3) Find the maximum number from the given array. 4) Write the signature of service returning all the records from the provided table. 5) Explain about the Json format.

3 Answers

I also had the similar experience here, all other people seem to be normal but this HR was some sick person, so assume that HR policies will be similar here. I am happy to decide that I will not be going here. Less

Thanks for the feedback, to me also HR gave the same dialogue about salary. And I decided to try for some other organization rather such fake company. I also believe the ratings given here 4.6 is fake. Less

It is a company of fraud people, so better to have distance with this company...

Infra.Market

You are given a matrix having 0s & 1s where each row & column is sorted also. So need to find the maximum matrix of 1s. e.g. Below is the given matrix, note each row & column is sorted. {0,0,0,0,1} {0,0,0,1,1} {0,1,1,1,1} {0,1,1,1,1} {1,1,1,1,1} so max matrix having 1s can be- 1,1,1,1 1,1,1,1 1,1,1,1

1 Answers

Though, later I solved the question same day, but again it took time for me to code. But I think below code should work which further can be improved- public class Matrix { public static void main(String[] args) { int[][] matrix = { {0,0,0,0,1}, {0,0,0,1,1}, {0,1,1,1,1}, {0,1,1,1,1}, {1,1,1,1,1} }; maxMatrix(matrix); } public static void maxMatrix(int[][] matrix) { int rows = matrix.length; int cols = matrix[0].length; for(int i = 1; i < rows; i++) { for(int j = 0; j < cols; j++) { if(matrix[i][j] == 1 && matrix[i-1][j] != 0) { matrix[i][j] = matrix[i-1][j]+1; } } } int[][] maxMatrix = maxRectangle(matrix, cols, rows); } public static int[][] maxRectangle(int[][] matrix, int cols, int rows) { int[] heights = matrix[rows-1]; int[] result = new int[cols]; int max = Integer.MIN_VALUE; result[0] = heights[0]; int i = 0; while(heights[i] == 0) i++; int start = i; for(; i < cols; i++) { result[i] = heights[i]*(cols-i); } for(i = start; i < cols; i++) { if(max < result[i]) { max = result[i]; start = i; } } int row = rows - heights[start]; int[][] maxMatrix = new int[heights[start]][cols-start]; for(i = 0; row < rows; row++,i++) { for(int j = 0,k = start; k < cols; k++,j++) { maxMatrix[i][j] = 1; } } return maxMatrix; } } Less

Zycus

Data Structures

1 Answers

geeksforgeeks

Zycus

Enums internals

1 Answers

enum are converted to a class which extends some Java class .. read more online

TEKsystems

collections, java 8, basic program. 2nd round was techno managerial,1 puzzle and questions around my resume.

1 Answers

hash map working, solved the puzzle and wrote the program to sort list of integers Less

Darwinbox

What are the different MySql engine?

1 Answers

Answered.

Farmers Insurance Group

TDD coding on a simple hash set

1 Answers

Numerous basic to moderate java dev questions

Viewing 1 - 10 of 265 Interview Questions