Interview questions
Software Developer/ Programmer interview questions – page 5
2,071 questions. Tap “Show answer” to check yourself.
-
Given a binary matrix of N X N of integers, you need to return only unique rows of binary arrayseg:
-
Given a Integer Array of length N, find the absolute difference of every pair of elements in the array. Do it faster than O(N^2)
-
There is an array of size 50 that is expected to contain all the numbers from 1 to 50 (every number occuring only once). But there is one number in the array that doesnot satisfy this condition i.e. one number is either duplicate or outside 1 to 5...
-
One irregular shape is given, provide algo to divide in multiple triangles.
-
Given a m*n binary array, find largest block of 1's.
-
(0,0) to (N,N) grid is there. You can move up and right from (0,0) to (N,N). How many paths are there? i n ii n^2 iii. n! iv. (2n)!/ (n! n!)
-
Each cell of an N x N grid is either a 0 or a 1. You are given two such N x N grids, the initial grid and the final grid. There is a button against each row and each column of the initial N x N grid. Pressing a row-button toggles the values of all...
-
Given a string or a sentence write a function to split the string on the basis of occurrences of white spaces. Note that occurrences of multiple white spaces will be counted as one. Do not use extra arrays for storing the split strings. Also do no...
-
Write a C program to create a bitmap of any size as determined by user. Say user says 64k bitmap, then create 64k long bitmap. Have set and unset methods.
-
Generating mnemonics of a phone keypad
-
Write an algorithm to check wether a given number is multiple of 5 or not? Make use of bitwise operators and concepts of GATES(OR, AND, XOR...)
-
You are given two strings, remove the characters from the first string which are present in the second string. They asked me to write complete code in my any language. The code should handle all the cases.
-
Given a BST, write a function to return a node with the given value as data, if no such node then return a node with smallest data greater then the searched value!!!! Also design test cases for the same
-
Given 2 numbers in base 10 with digits given in MSB to LSB order in a singly linked list, add the two numbers and return the result as a linked list in MSB to LSB order. Do this in < 4n operations on the given linked lists (including traversals...
-
For a given file(80 column and 100 lines) find in how many lines a word occur. the answer is like:
-
In binary search we have two comparisons one for greater than and other for less than the mid value. Optimize so that we need to check only once.
-
Given unsorted array and a no. X ,find 2 no. whose sum is X...a[i]+a[j]=X ...do it in O(n)
-
Suppose you have an NxN matrix of positive and negative integers. Write some code that finds the sub-matrix with the maximum sum of its elements.
-
Given an input string S write a function which returns true if it satisfies S = nT. Basically you have to find if a given string can be represented from a substring by iternating it "n" times. n >= 2
-
An array contain +ve and -ve element, find subarray whose sum =0;
-
There are 2 types of bricks 1*2 and 1*3, in how many ways can u build a wall of length n and height 1. i.e for wall of length 7 and height 1 ans - 223, 232, 322 for wall of size 8 ans - 2222, 233, 323, 332
-
Without using /, % and * operators. Write a function to divide a number by 3. itoa() function is available.
-
An array of integers of size n. Generate a random permutation of the array, given a function rand_n() that returns an integer between 1 and n, both inclusive, with equal probability. What is the expected time of your algorithm?
-
You are given a game of Tic Tac Toe. You have to write a function in which you pass the whole game and name of a player. The function will return whether the player has won the game or not. First you to decide which data structure you will use for...
-
Convert a double-precision number to rational, i.e.:
-
Find the median of two sorted arrays
-
Given a file containing 4,300,000,000 integers, how can you find one that appears at least twice?
-
Find the point of intersection of two rectangles
-
There is a single Linked List, reverse the list using only one extra pointer ..i.e you can create only one extra pointer other than the head.
-
2D array sorted row wise and column wise. Find an element 'n' in an optimal way.