Software Developer Interview Questions | Glassdoor.co.in

Software Developer Interview Questions

10,363

Software developer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Given a string "aaabbbcc", compress it, = "a3b3c2" . Given that output string's length is always smaller than input string, you have do it inplace. No extra space

23 Answers

public static String cstr(String a){ if(a.length()<2){return a;} if(a.length()==2){if(a.charAt(0)==a.charAt(1)){return a.charAt(0)+"2";}else{return a;}} for(int i=0;i

#include #include #include #define STR_SIZE 26 int main() { /* Current char sequence tracker */ char *c = NULL; char *b = NULL; char *str = (char*)malloc(STR_SIZE * sizeof(char)); if(NULL == str) return -1; memcpy(str, "aaaabbbcceeeeefffffff", 26); b = c = str; printf("Input: %s\n", b); while(*str) { if(*(str+1) != *str) // Repeat sequence ends { // Add 48 so the count gets printed as a char *(c+1) = ((str-c+1)+48); // Updated count, copy rest of the string starting after the count position memcpy(c+2, str+1, strlen(str)); // Update c to point to the new char repeat sequence c = c+2; } str++; } /* b was initialized to point to str up top, proving it was done in place */ printf("Output:%s\n", b); free(b); b = NULL; return 0; }

String test="aavvvqwqaa"; int count=0,start=0,end=0; int length=test.length(); for(int i=0;i

Why do you want to join Wipro ? and please don't give me crap answers !

11 Answers

Given an array of numbers, nums, return an array of numbers products, where products[i] is the product of all nums[j], j != i. Input : [1, 2, 3, 4, 5] Output: [(2*3*4*5), (1*3*4*5), (1*2*4*5), (1*2*3*5), (1*2*3*4)] = [120, 60, 40, 30, 24] You must do this in O(N) without using division.

13 Answers

out of 25 horses select the fastest three in minimum number of races where in each race there would be exactly five horses.

10 Answers

Find all anagrams in a file. Improve the running time to O(n).

7 Answers

Puzzle: There are 25 horses and 5 lanes for conducting a race among them. In a minimum of how many races, would be able to find out the 3 fastest horses among them? Assumption: Speed of horses are consistent enough across races.

5 Answers

The coding problem in 2nd round.

5 Answers

Given an integer array which consists of numbers from 1 to N with 1 number missing find the missing number. What will you do if 2 numbers are missing?

4 Answers

Consider a stack of N number of cards which are piled up and in facing down. Each card has a unique number from the range 1 to N. The card is stacked in such a way that it exhibits the following behavior: Take the first card and put it under the stack without revealing. Now the next card on the top will have the number 1 on it. Next take 2 cards one after the other and put is under the stack without revealing. Yes you guessed it right - the next card on the top will reveal a value of 2. This goes on. Eg. for such a series : 9,1,8,5,2,4,7,6,3,10 [for N=10] Write a program to generate such a series for a given N number of cards so that this behavior can be exercised.

8 Answers

You have a list of sentences/words. How to find out the sub list that consists of a specific prefix? Ex: input: prefix="he", list = ["hello", "world", "hello world", "hey dude", "galaxy"....] output: ["hello", "hello world", "hey dude"]

4 Answers
110 of 10,363 Interview Questions