Sollicitatievragen voor Software engineer | Glassdoor.nl

# Software engineer sollicitatievragen

1,183

Sollicitatievragen voor software engineer gedeeld door sollicitanten

## Top sollicitatievragen

Sorteren: RelevantiePopulair Datum

### Software Engineer bij Booking.com werd aangegeven...

23 mrt. 2017
 Swap two digits from an integer, the result should be the maximum. For example 3580 -> 835010 antwoordenSearch a string inside a file line by line and return that particular line plus k previous linepublic static int findMax(int start, int[] digits){ int max = Integer.MIN_VALUE; int id = 0; for (int i=start;i 0){ digits[k] = num % 10; num = num /10; k--; } for (int i=0;ipublic static int findMax(int start, int[] digits){ int max = Integer.MIN_VALUE; int id = 0; for (int i=start;i 0){ digits[k] = num % 10; num = num /10; k--; } for (int i=0;iToon meer reacties Glassdoor somehow merges my comment. Correct solution: public static int findMax(int start, int[] digits){ int max = Integer.MIN_VALUE; int id = 0; for (int i=start;ipublic static void print(Integer number) { int num = number; int count =Integer.toString(num).length(); int[] digits = new int[count]; int k = count-1; while (num > 0){ digits[k] = num % 10; num = num /10; k--; } for (int i=0;iprivate static int swap(int num) { String str = Integer.toString(num); int msd = str.charAt(0) - 48; int swapPos = -1; int maxDiff = -1; for(int counter = 1 ; counter = maxDiff) { maxDiff = diff; swapPos = counter; } } if(swapPos!=-1) { StringBuffer sb = new StringBuffer(str); sb.replace(0, 1, "" + str.charAt(swapPos)); sb.replace(swapPos, swapPos+1, ""+ msd); return Integer.parseInt(sb.toString()); } System.out.println(msd); return num; }code <=fun maximize(input: Int): Int { fun Int.pow(exponent: Int): Int = toDouble().pow(exponent).toInt() fun Int.digit(position: Int): Int = (this / 10.pow(position)).rem(10) var working = input var digits = 0 while (working > 0) { working /= 10 digits++ } return generateSequence(1) {it + 1} .takeWhile { it generateSequence(top - 1) {it - 1}.takeWhile { it >= 0 }.map { top to it } } .map { pair -> val top = input.digit(pair.first) val bottom = input.digit(pair.second) input - top * 10.pow(pair.first) - bottom * 10.pow(pair.second) + top * 10.pow(pair.second) + bottom * 10.pow(pair.first) } .max() ?: 0 } Dit bericht is verwijderd. Zie onze Gedragscode of Gebruiksvoorwaarden voor meer informatie. Zie onze Gedragscode of Servicevoorwaarden voor meer informatie.

### Android Developer bij Booking.com werd aangegeven...

15 mei 2015
 Write a function that would calculate a Pascal triangle element, given its coordinates.8 antwoordenpublic static void triangle(int maxRows) { int r, num; for (int i = 0; i 0; j--) { System.out.print(" "); } for (int col = 0; col 0) { num = num * (r - col) / col; } System.out.print(num + " "); } System.out.println(); } }public static long triangleReturnCoordinate(int itemRow, int itemColumn) { long num = 1; if (itemColumn itemRow) { return -1; } else { for (int columnId = 0; columnId 0) { num = num * (itemRow - columnId) / columnId; } if (columnId == itemColumn - 1) { break; } } return num; } }Generally Pascal's triangle is considered to be 0-indexed, as it is based on combinations. public long Pascal(long n, long r) { if (r > n || r n) return Pascal(n, n - r); if (r == 0) return 1; return n * Pascal(n - 1, r - 1) / r; }Toon meer reacties private static int nCalc(int n,int k){ return factorial(n) / (factorial(k) * factorial(n-k)); } private static int factorial(int f){ int retval = 1; for (int i=1;i<=f;i++){ retval*=i; } return retval; }public static void main(String[] args) { int r = 5; for (int i = 1 ; i <= r; i ++) { int c = 1; for (int j = 1; j <= i; j ++) { System.out.print(c); c = c * (i - j) / j; } System.out.println(); } }This is how you print pascal triangle public void printPascalWithGivenInputs(int rows){ int noOfRows = rows; int noOfColumns = 2*noOfRows -1; int[][] pascalArr = new int[noOfRows][noOfColumns]; int middleIndex = noOfColumns/2; for(int outerIndex =0; outerIndexpublic int getPascalElement(int row, int collumn) { if (collumn == 0 || collumn == row) { return 1; } return getPascalElement(row-1,collumn-1) + getPascalElement( row-1,collumn); } Dit bericht is verwijderd. Zie onze Gedragscode of Gebruiksvoorwaarden voor meer informatie. Zie onze Gedragscode of Servicevoorwaarden voor meer informatie.

### Software Developer bij Booking.com werd aangegeven...

30 okt. 2015
 Call a function F in a loop. F returns a string of 140 chars. Write to the output 1 when F returns a string with the same letters (basically a permutation) of a string previously returned. (the question was not this well formed)7 antwoordenBuild an hashmap where for every letter you count how many times it appears in the string, and put it in a set. For every string check if the set contains the built hash. OR sort the string, and put it in a setI think sorting the word would work much better and is easier to understandThis is called AnagramToon meer reacties "and put it in a set." to put it in a set you need to implement a way to compare hashs What you would need is 1 - build your hash for given word(O(n)) 2 - check if the word is present in every other hash with same quantity, since you will need to compare with all previous words everytime the complexity is O(nk) where k is the number of distinct words so overal complexity O(nk)You can either create a custom hash function which is very complex or compress the phrase like: a4b6f.... ordered alphabetically. If the 2 compressed phrases mach, they are anagrams. The complexity would be O(140) to compress each phrase * n phrases which leads to O(n) complexity.Short python answer: def findPermutationsSort(): res = f([]) perm_dict = {} for s in res: key = ''.join(sorted(s)) if key in perm_dict: print 1 else: perm_dict[key] = 1 Dit bericht is verwijderd. Zie onze Gedragscode of Gebruiksvoorwaarden voor meer informatie. Zie onze Gedragscode of Servicevoorwaarden voor meer informatie.

24 aug. 2016

### Software Developer bij Booking.com werd aangegeven...

30 mrt. 2017
 We have a log file, can grow pretty big. Each line is a trace-log, and the first field is the RequestID. We need to scan the file, and print all the logs for requests which resulted in error .. 001 BEGIN 001 fetched from db 001 some processing .. 002 BEGIN .. 002 fetched from db 001 returned success 003 BEGIN 001 END 003 some work 002 ERROR 003 some other work5 antwoordenpublic static void print(String fileName) throws IOException { RandomAccessFile randomFile = new RandomAccessFile(fileName, "r"); long position=randomFile.length()-1; int thisCode; char thisChar; String thisLine; String reqId = ""; while (position >= 0){ randomFile.seek(position); thisCode = randomFile.readByte(); thisChar = (char) thisCode; if (thisChar == 10 || position==0) { if (position == 0) randomFile.seek(position); thisLine = randomFile.readLine(); if (thisLine != null) { int i = thisLine.indexOf(" "); if (i>0) { String id = thisLine.substring(0, i); if (thisLine.contains("ERROR") || id.equalsIgnoreCase(reqId)) { reqId = id; System.out.println(thisLine); } } } } position--; } }In Java we can use Scanner object and its findInLine method to search using regexp patternsawk: /ERROR/{ print buffer[\$1],\$0 } /END/{ delete buffer[\$1] } //{ buffer[\$1] = buffer[\$1],\$0 }Toon meer reacties actualy in prev solution /END/ should be at the endFiles.lines(new File("Log.txt").toPath()).filter(f->f.contains("Error")).collect(Collectors.toList());

14 jan. 2016

### Junior Software Engineer bij TomTom werd aangegeven...

2 dec. 2015
 if p1 and p2 are two consecutive prime number, in which cases (p1 + p2) / 2 is a prime number.5 antwoordenIn no cases.1 is not a prime numberToon meer reacties Assume that p3 = p1 + p2 / 2 is a prime number for some consecutive p1, p2. Since p3 is the mean of p1 and p2, p1 < p3 < p2. This is a contradiction to p1 and p2 being consecutive prime numbers. Therefore, the mean of p1 and p2 cannot be a prime number.Any prime number is an odd number so if p1 is odd the consecutive number p1+1 will be even which contradicts p2 to be prime. Hence its not possible. Dit bericht is verwijderd. Zie onze Gedragscode of Gebruiksvoorwaarden voor meer informatie. Zie onze Gedragscode of Servicevoorwaarden voor meer informatie.

### Java Developer bij Adyen werd aangegeven...

23 apr. 2018
 questions based on your test, problem solving approach, java multithreading, query optimization etc.5 antwoordenI've got an interview with them too. Could you please brief your experience? Thanks much.Hi can you share your experience of face to face interview. ThanksToon meer reacties Hi. How much score do they expect in codility test. I have given the test and out of 4 I got 100 for 2 and zero for 2 although all the test cases ran successfully. My score is below 60. Can I expect a call for further rounds.Hi. How much score do they expect in codility test. I have given the test and out of 4 I got 100 for 2 and zero for 2 although all the test cases ran successfully. My score is below 60. Can I expect a call for further rounds. Dit bericht is verwijderd. Zie onze Gedragscode of Gebruiksvoorwaarden voor meer informatie. Zie onze Gedragscode of Servicevoorwaarden voor meer informatie.

### IOS Developer bij Booking.com werd aangegeven...

25 aug. 2016
 Implement the MyStack. (A lot of questions about multi-threading) @protocol Stack -(void)pushObject:(nonnull id)obj; -(nonnull id)popObjext; @property(nonatomic,assign)NSInteger count; @end @interface MyStack : NSObject @end @implementation MyStack @end4 antwoordenDid you have any system design questions?Can you give me an example what you mean? Stack is considered as System Design?You interviewed in person at booking? What kind of technical questions did you face? Could you give some details.Toon meer reacties @protocol Stack -(void)pushObject:(nonnull id)obj; -(nonnull id)popObject; @property(nonatomic,assign) NSInteger count; @end @interface MyStack : NSObject @property (nonatomic, strong) NSMutableArray *contents; @end @implementation MyStack @synthesize count; - (id)init { if (self = [super init]) { self.contents = [NSMutableArray array]; } return self; } - (NSInteger)count { return self.contents.count; } - (void)pushObject:(nonnull id)obj { if(obj) { [self.contents addObject:obj]; } } - (nonnull id)popObject { if ([self.contents count] > 0) { id lastObj = [self.contents lastObject]; [self.contents removeLastObject]; return lastObj; } return [NSNumber numberWithInteger:-1]; } - (void)print { for (id obj in self.contents) { NSLog(@"%ld",(long)[(NSNumber*)obj integerValue]); } } @end

### Team Lead Developer bij Booking.com werd aangegeven...

22 mei 2014
 Given an array of numbers, e.g. [5,0,9,2,5,5,5] - return all the consecutive numbers that add up to N.3 antwoordenThere were two followup questions to this. a) What if there are lot of zeros after the sum is 10. E.g. 505000000 - what would it return? b) what if we allow negative numbers. For example 5,5,-6,6,0,0 We also discussed its time complexity.The following should work. cheers! public int[] calculateSumSet(int[] inputArray, int desiredSum) { for (int stratingIndex = 0; stratingIndex < inputArray.length; stratingIndex++) { int sumOfSubArray = -1; int endingIndex = stratingIndex; do { sumOfSubArray = getSum(inputArray, stratingIndex, endingIndex); if (desiredSum == sumOfSubArray) { return subArray(inputArray, stratingIndex, endingIndex); } endingIndex++; } while (endingIndex < inputArray.length);//&& sumOfSubArray < desiredSum } return null; } private int getSum(int[] inputArray, int stratingIndex, int endingIndex) { int retValue = 0; for (int i = stratingIndex; i <= endingIndex; i++) { retValue += inputArray[i]; } return retValue; } private int[] subArray(int[] inputArray, int stratingIndex, int endingIndex) { int[] retValue = new int[endingIndex - stratingIndex + 1]; int j = 0; for (int i = stratingIndex; i <= endingIndex; i++) { retValue[j] = inputArray[i]; j++; } return retValue; }Hi, What made you say that "Talking about TDD in a company where tests virtually do not exist is a big no-no"? Did you talk about it in general or did you make your presentation on/about TDD? What do you recommend for future candidates? --prospective candidate
110 van 1,183 Sollicitatievragen

Meer