## Recent Interview Questions

- 0of 0 votes
Given a list of currency exchange rates like this:

EUR/USD => 1.2

USD/GBP => 0.75

GBP/AUD => 1.7

AUD/JPY => 90

GBP/JPY => 150

JPY/INR => 0.6

write a method`double convert(String sourceCurrency, double amount, String destCurrency);`

For example, convert(EUR, 100, INR)

The method should minimize the number of intermediate conversions.

- 0of 0 votes
You are given an arbitrary number of graphs using sets such as {a,b,c,d,a}, {a,b,a}, {e,f,g,h,e}... etc. Assume each element at position x_i in a set has a directed edge to x_{i+1}. so a-->b, b-->c etc. Write a program that selects a subset of at mot k vertices that contains at least one vertex from every directed cycle in the graph.

- 0of 0 votes
Write a program that always produces a two-way Euler tour that can be drawn such as it does not cross itself at any vertex.

- 0of 0 votes
let's say you're given an arbitrary list of relations r1 and r2 from objects in a set of arbitrary size. find the size of th largest subset with the property that no two are related. for e.g., given set S = {a,b,c,d,e,f} and relations {a,d}, {b,c}, {a,c}, {a,e}, find the subset of S such that no two a connected.

- -2of 2 votes
There was given total physical energy H and total distance D. Five pace information speed and corresponding physical energy was given. Find the minimum time that is required in order to complete total distance D making sure that some of the physical energy does not exceed H

- 0of 0 votes
I came across this in a contest and haven't been able to solve it yet.

You are located at point 0 having p units of petrol, and you need to reach a point N. car consumes one unit of petrol every unit of distance it travels. Find minimum number of stops you need to make to reach the end.

for eg:

dis, petrol

3 , 15

6 , 4

8 , 5

15 , 6

output is 1 is distace to travel is 20 and inital petrol is 17.

The town is situated at co-ordinate 0. All the other distances are given with respect to town's location.

I initally though about the greedy approach but that only working in case you have enough petrol in petrol station to reach the next station.

- 0of 0 votes
given a target node in a directed graph, find the shortest cycle including this node, return the whole path.

- 0of 0 votes
There are n bus lines, known bus stops by bus, the bus is bi-direction, ask from station A to station B at least a few transfers.

- 0of 0 votes
Implement a trie tree which can add and search word, an extra "*" sign will also be considered, similar to Leetcode 211 but with "*"

'*' means any sequence of characters (including the empty sequence).

- 0of 0 votes
Given a Map (representing an old phone key number and possible letters present there) and a sequence of keys return all possible combinations of strings that are possible to produce.

`Map<String, String[]> map = new HashMap<String, String[]>(); map.put("1", new String[] { "a", "b", "c" }); map.put("2", new String[] { "c", "d", "e" }); map.put("3", new String[] { "f", "g", "h" }); String in = "12"; List<String> mix(String in, Map<String, String[]> map)`

The result for "1,2" should be [ac, bc, cc, ad, bd, cd, ae, be, ce]

- 0of 0 votes
`given a binary array, you can flip 0 -> 1 or 1 -> 0 to make all the 1 are in the left part and all the 0 to the right part, return the minimun flip required example 1 1011000 -> 1111000 only need one flip 0 -> 1 example 2 00001 -> 10000 require 2 flips public int findMiniFlip(int[] nums) { } }`

- 0of 0 votes
Count number of ways to paint a fence with N posts using K colors, where no FOUR consecutive fences can have the same color.

- 0of 0 votes
Are you looking for Facebook Reset Password Services - 8663243042

- 0of 0 votes
Robot hand movement

Given a (1) string message (consisting of only upper case alphabets), and (2) width of keyboard, output the movements required by an automated robot hand to print out the string message.

The robot hand can move right, left, up or down. It cannot move diagonally.

Ex 1:

String message: “HI”

Width: 26

Output: R8, T, R1, T

Ex2:

String message: “HELLO”

Width: 13

Output: R8, T, L3, T, R7, T, T, D1, L10, T

- 0of 0 votes
Write all the possible numbers returned from a calculator pad where a start number move in a L direction in any directions(1-2moves)

ie. From calculator pad. Start from 8 --> go in L shape (2up, 1right), and it returns 3

ie. Start from 2, (move 2 down, 1 left), it will be 7

ie. Start from 2(move 2 down, 1 right), it will be 9

ie. Start from 7(move 1 left, 2 up), it will be 2

ie. Start from 7(move 1 up, 2 left), it will be 6

- 0of 0 votes
Implement the code to parse a string into a value type? you are implementing the library functionality for Enum.Parse

1. How do you discover valid values?

2.What do you do when the user asks for you to parse an invalid value?

3.How do you handle casing issues?

- 0of 0 votes
Let's assume that we have a binary classification system that classifies sets of samples, the rules for the classification are:

The set is 'GOOD' if ALL the samples are 'GOOD'

The set is 'BAD' if ANY sample in the set is 'BAD'

Based on this we receive an input that contains multiple lines, where each line represents the classification of a set of samples. The format of each line is

class,sample_id_1,sample_id_2,...,sample_id_n

where class will either be GOOD or BAD. The sample IDs represent the samples contained in the classified set.

Now, for generating the output response we have to consider three cases:

If a unique mapping of samples-to-class exists, we output the corresponding mapping (sorted by the samples IDs)

If no consistent sample-to-class is possible, we output the answer NO CONSISTENT

If more than one mapping would be consistent, we output the answer MULTIPLE MAPPING.

To better illustrate the problem, following there are 4 examples

Sample Input

GOOD,10,11

GOOD,11,12

GOOD,10,12

Sample Output

10,GOOD

11,GOOD

12,GOOD

Sample Input

GOOD,10,11

BAD,11,12

Sample Output

10,GOOD

11,GOOD

12,BAD

Sample Input

GOOD,10,11

BAD,11,12

GOOD,11,13

GOOD,12,13

Sample Output

NO CONSISTENT

Sample Input

BAD,10,11

BAD,11,12

Sample Output

MULTIPLE MAPPING

If someone knows how to solve the problem, even if it's just pseudocode I'd really appreciate it

- 0of 0 votes
Dear Friends,

please help to get the logic for the below , basically it is atoi implimentation question.

input : string as 0x1234

output : in int formate 0x1234

if input: 0x12Ab43

output should be 0x12Ab43

if input : 0xdY6

outpust : should give an error , since Y is out of scope.

- 0of 0 votes
the longest unique value path in a graph

/**

* Definition for undirected graph.

* class UndirectedGraphNode {

* int label;

* List<UndirectedGraphNode> neighbors;

* UndirectedGraphNode(int x) { label = x; neighbors = new ArrayList<UndirectedGraphNode>(); }

* };

*/

public class Solution {

public int findLongestUniqueValuePath(List<UndirectedGraphNode> node) {

}

}

- 0of 0 votes
Basic sales tax is applicable at a rate of 10% on all goods, except books, food, and medical products that are exempt. Import duty is an additional sales tax applicable on all imported goods at a rate of 5%, with no exemptions.

When I purchase items I receive a receipt which lists the name of all the items and their price (including tax), finishing with the total cost of the items, and the total amounts of sales taxes paid. The rounding rules for sales tax are that for a tax rate of n%, a shelf price of p contains (np/100 rounded up to the nearest 0.05) amount of sales tax.

Write an application that prints out the receipt details for these shopping baskets.

Input:

1) 1 book at 12.49

2) 1 music CD at 14.99

3) 1 chocolate bar at 0.85

- 0of 0 votes
Given a string s, break s such that every substring of the partition can be found in the dictionary.

Return the minimum break needed.

Example

Given a String CatMat

Given a dictionary ["Cat", "Mat", "Ca", "tM", "at", "C", "Dog", "og", "Do"]

return 1

we can break the sentences in three ways, as follows:

CatMat = Cat Mat break 1

CatMat = Ca tM at break 2

CatMat = C at Mat break 2

but the first way has the minimum break, thus return 1

public int wordBreak(String s, Set<String> dict) {

// Write your code here

}

- 0of 0 votes
Given a 2d grid map of '1's (land) and '0's (water), find the perimeter of each island. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.

- 0of 0 votes
To determine if two graphs have isomorphism or not

- 0of 0 votes
Give an array A, find the (i, j) pairs that satisfy the condition.

Condition 1: A [j] = A [i] + 1, Condition 2: j - i is as large as possible

Followup condition 1 is changed to A [j]> A [i]

- 0of 0 votes
Given an array of length n + 1, containing elements 1 through n and a space,

Requires the use of a given swap (index i, index j) function to sort the array,

You can only swap the gap and a number, in the end, put the gap at the end

- 0of 0 votes
find a shortest string to cover all of a list of string,

For example, [aab, aabb, bc], should return aabbc,

because aab, aabb, bc are all the substring of aabbc

- 0of 0 votes
Given two strings containing only numbers, return product of the two strings. Strings are large so conversion to interger is not possible.

- 0of 0 votes
Your code is inside a service that receives a large stream of integers, large enough that it can't be stored on any disk. You don't know the how many integers will be there on the stream. You have to write a sampler which selects K integers such that likelihood of selecting any integer from the stream is equal.

- 0of 0 votes
How to find three largest numbers in array?

- 0of 0 votes
Given a grid of M*N size and robot is sitting on the top leftmost corner (0,0) and has to reach the bottom right most corner (M-1,N-1). Robot can only move up, down, left or right and cannot move diagonally. Find the shortest path on the grid.

Follow find total number of paths possible.