Interview questions
Algorithm interview questions – page 10
811 questions. Tap “Show answer” to check yourself.
-
You have 2-d array, with m length and n width.You are also given k, ( k<=n && k<=m ). Now, select a square of size k, which returns maximum sum.In Minimum Time Complexity
-
Given a number n... print a spiral matrix in O(1) space example if n=5 the op should be:
-
Given a 3D space and earth at its center. Find 100 closest stars in the 3D space to the earth.
-
Given an integer n, give an O(log n) algorithm to determine if n is divisible by 5 without using division or mod.
-
Excel labels its rows with letters. For example row 0 is labeled 'A', row 1 is labeled 'B', row 26 is labeled 'AA', and so on.
-
Given a 4*4 matrix, arrange it such that sum of elements in every submatrix of size 2*2 is 30. The elements of 4*4 matrix were such that they could be rearranged with given requirement. They asked me to code it.
-
Write a func that will return second min weighted path between two nodes.(in linear time).
-
There are a set of n integers. Describe an algorithm to nd for each of all its subsets of n-1 integers the product of its integers
-
Given a stream of N integers which has the property that no integer is more than 1000 positions away from its sorted location, how would you output the integers in sorted order while using constant storage?
-
Implement a search engine. The input will be 100 text files. Return the paragraph and the file in which the keyword appears.
-
Write a function that takes as input two integer arrays of length n, input and index, and generates a third array, result, such that: result = product of everything in input except input[index]
-
Given an unsorted array and two numbers, find the minimum distance between them. For example, if the array is {1,2, 10, 2, 3, 5, 2, 1, 5} distance between 2 and 5 is 1.
-
Given a large file and a word, find the frequency of the word.
-
Suppose there is a circle. You have five points on that circle. Each point corresponds to a petrol pump. You are given two sets of data.
-
Given an integer, print the next "smallest" and next "largest" number that have the same number of 1 bits in their binary representation.
-
Build a binary search tree using prefix traversal only.
-
Implement auto calling functionality of the mobile phone(T9)
-
How to find duplicate element (only one element is repeated) from an array of unsorted positive integers. time complexity .. O(n) space .. o(1).
-
Algorithm to partition set of numbers into two s.t. diff bw their sum is min and they hav equal num of elements
-
Explain an algorithm for path planning in a given map.
-
Given an integer with all different digits, find the next integer with same digits.
-
There are n computers [c1, c2, ..., cn] and connections between computers [ca, cb] means there is connection between computer a to computer b. Write an algorithm to find the how many computers are connected each other
-
Find top log(n) or top sqt(n) values in an array of integers in less than linear time.
-
Merge 2 sorted arrays in constant space and minimum time complexity.
-
Given 'n' no of sets and each set is of a variable size. Find out the cross product of these 'n' of sets.
-
Given location of two points on globe as latitude and longitude, WAP to find the shortest path between given two points...
-
Write a program to remove blank spaces from a file
-
What is the shortest single line in a C program which will take more than a google years to execute, but will eventually complete? You are permitted to have code before or after the line, but execution of the code must remain on that line, meaning...
-
How do you partition an array into 2 parts such that the two parts have equal average?...each partition may contain elements that are non-contiguous in the array...
-
Given n points find maximum number of collinear points ..focus on time & space complexity