Interview questions
Algorithm interview questions – page 17
811 questions. Tap “Show answer” to check yourself.
-
Write a program to find if a password entered is a valid password( meet the given criteria like should have characters, special characters etc):
-
Read a file of this format:
-
How do you apply Binary Search on 2D array supposed you have 2D array with integers sorted both horizontally and vertically. If you find any occurrence of the value you are looking for you return true else false. What is the complexity? For example the 2D
-
Input -> India is a great country. Key(alphanumeric) - B2. You have to encrypt the given sentence, in such a way that only the words should be jumbled.
-
Write a code segment called isFibonacci(), which, when given a variable array of integers, checks whether it is a part of the Fibonacci sequence or not? (This was asked for the second round)
-
Given an nxn screen, Each pixel is represented by intensity values. Given a specific pixel as an input, find the no. of pixels of the same colour which can reached from this pixel. Assume any suitable data structure for a screen.
-
Ou have a Word Processor type Program. There are 2^16 fonts. Each font is associated with a 4MB geometric instruction set. This is written in a flat file. Everytime a user selects a font this file is searched linearly. Develop a program to o...
-
Suppse a binary tree is stored in an array( a) such that a[i] is the parent of i. Suppose one element is 5, so the parent of the element 5 is in a[5], the parent of the root is -1. It is not a binary seach tree. So what will be the "easiest" imple...
-
Write code for factorial function in one line
-
Given an n*m matrix of letters and a dictionary find all the valid words from it.Implement the functions that you wud use on dictionary .Ex func like bool isValidWord(String) ..which you would use on dictionary
-
Given a set of KEY->VALUE pairs such that each KEY is unique, describe a method of storing these pairs on disk, and a method for accessing the corresponding VALUE given a KEY. Assume that RAM is fixed at 1gb and the set of pairs re...
-
Write a function to find out if a given tree is a binary search tree (BST) or not? Remember to use minimal space. For eg, we know that if an inorder traversal of the tree gives a sorted set of elements then it is a BST else it is not. But this re...
-
Given a binary tree, write a program to find the cousin nodes of the given node.
-
You have been given a linked list of numbers. The size is not known. You need to find out if the number stored in the list is a palindrome in the best possible optimized manner.
-
Offered a string S of alphabets and two characters a,b discover the minimum distance amongst circumstances of them these that position of a > position of b.
-
A rectangle is defined by two pts i.e, top left and bottom right . write a function that accepts four pts defining two rectangles and return whether they are intersecting or not!!!
-
Solve the Rat In A Maze problem , What Data Structure You will us to solve it , what the time & space complexity of your program
-
A matrix full of L(land) and D's(Deserts). At each time D converts surrounding L's to D's. Deserts eats Land. Given a matrix find out scenario after t time
-
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.
-
If u could find the (n/4)th element of an array in O(n) time, then what is the worst time complexity of quick sort algo if this algo is used to decide the pivot element.
-
Write a function that would have as input a string,and list of characters to be deleted from the string. Write Test Cases.
-
Given two rectangles, how would you find out whether one rectangle lies inside another?
-
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to buy one share of the stock and sell one share of the stock, design an algorithm to find the best times to buy and sell
-
The next highest number in the given sequence ex: input:213476-->213467 54321--> -1
-
The store placed the paper order forms in a 10x10 array of bins, using the last two digits of the customer's phone number as the hash index. When the customer telephoned an order, it was placed in the proper bin. When the customer arri...
-
Fiven n points find m points closer to origin
-
A string is well formed if for every "(" left parenthesis you have matching right one ")".In the same way every ")" should have a preceding "(".write a program finds if a string is wellformed.
-
What's the max insertion time for a hash table?
-
Which algorithm is better among quick sort and Heapsort and why?
-
Pretend there is a robot that has to navigate a maze (N x M). The robot can only move down or right and the maze can contain walls. Write an algorithm to determine the number of paths the robot can take.