Tech Architect interview questions – page 4
1,161 questions. Tap “Show answer” to check yourself.
-
Given an histogram.. find out the maximum rectangle in it.. You are given the histogram as an array of heights of each bar.. find it in O(n)..
-
How to find the two numbers whose difference is minimum among the set of numbers ?? One solution is sort numbers and compare adjacent numbers to get minimum.. complexity O(nlogn).. Is there O(n) solution for this problem ??
-
How to generate the following series using recursion say for n(suppose n=4) print 4 3 2 1 2 3 4
-
Write code that implements Huffman Coding
-
Given two log files, each with a billion usernames (each username appended to the log file), find the usernames existing in both documents in the most efficient manner? Use pseudo-code or code. If your code calls pre-existing library functions, cr...
-
You have a fair coin. Make it unfair with win and loose probability p and (1-p) respectively, where p is greater than 0 less than 1 tryv to optimize asmuch as possible write maths behind this clearly
-
Given a set S, find all the maximal subsets whose sum <= k. For example, if S = {1, 2, 3, 4, 5} and k = 7 Output is: {1, 2, 3} {1, 2, 4} {1, 5} {2, 5} {3, 4}
-
Given an array which has all the elements occuring thrice except one number which occurs only once. Find the number?
-
The base class Arrray belongs to the mamespace
-
A frog has to cross a river. There are n rocks in the river, using which the frog can leap across the river. On its way across the river the frog can chose to skip a rock, but it cannot skip two consecutive rocks because that would be two far a di...
-
Given a series A,B,C .......Z, AA, AB,AC,AD....AZ,BA,BB...BZ,CA....(Open excel sheet. The names of column represent the series). Given input as number 'n'. Output the 'n' th string of the series. & also vice versa if given string prints its co...
-
You are given 2 arrays of size 'n' each. You need to stable-merge these arrays such that in the new array sum of product of consecutive elements is maximized. eg A= { 2, 1, 3} B= { 3, 7, 9} Stable merging A and B will give ...
- Advertisement
-
Find a number from the array, which on sutracting with the given number gives minimum value ex: array= 2,5,6,8,9 gn number = 1 it should print 2 coz 1 - 2 = -1
-
You are given an array of integers, say array1 of size n. You have to create another array (say array2) and fill its contents by following this rule: array2[i] will hold the value of the left-most integer from the range array1[i+1] to array1[n-1] ...
-
Design OOP constructs for the following functinoarlity. There are multiple types of phones (android, iphone etc). Each phone has a subset of features (voice, text, etc). How would you write the classes and inheritance esp. in C++?
-
Implement a superqueue DATA STRUCTURE ...like a queue with normal queue operations AND finding the maximum value in a constant amount of timeO(1)
-
Find out missing no. from a stack if two given stacks have same numbers
-
In a given array of elements like [a1, a2, a3, a4, ..... an, b1, b2, b3, b4, ....... bn, c1, c2, c3, c4, ........ cn]
-
Let f(n, k) be the # of ways of choosing k integers without replacement from n consecutive integers so that no two selected are consecutive. a. give a recurrence for f(n, k) b. efficient implementation of f(n, k)
-
Describe recursive mergesort and its run-time. Write an iterative version in C++/Java/Python.
-
Given 3 arrays x[],y[],z[] all sotted
-
Write a program to add two long positive numbers (each represented by linked lists)
-
Write a graph class and interface for the graph in C++
-
You are given an array that contains integers. The integers content is such that every integer occurs 3 times in that array leaving one integer that appears only once. Fastest way to find that single integer -- using memory. -- not usi...
- Advertisement
-
How to count number of unique music titles downloaded from a log file which contains an entry of all music title downloaded?
-
Given an unsorted array of integers containing both negative and positive number, find all the pairs that sum to a given value say 'total'.
-
You can place weights on both side of weighing balance and you need to measure all weights between 1 and 1000. For example if you have weights 1 and 3,now you can measure 1,3 and 4 like earlier case, and also you can measure 2,by placing 3 on one ...
-
Given an unsorted array of positive integers and an integer N, return N if N exist in the array or the first number that is smaller than N.
-
Given an array containing numbers from 1 to N. Numbers are in also in range from 1 to N. Some numbers are missing and some numbers are repeated more than once. Find the missing numbers in O(n)
-
You are given an array of n elements which contains elements from 0 to n-1, with any of these numbers appearing any number of time. We have to find these duplicating numbers in O(n) and using only constant memory space. for eg suppose ...