## Recent Interview Questions

- 0of 0 votes
Give you a bunch of data <key, value, expiredTime>, design a data structure storage.

About the idea, based on Map solution.

class NewMap {

Map <Integer, Integer> data = new HashMap <> (); // store key-value pairs

Map <Integer, Integer> expired = new HashMap <> (); // store key-expired pairs

}

Then implement the three functions get (), put (), expire ().

- 1of 1 vote
Twitter

Create a simple stack which takes a list of elements.

Each element contains a stack operator (push, pop, inc) and a value to either push/pop or two values, n and m,

which increment the bottom n values by m.

Then print the topmost value of the stack after every operation. If the stack is empty, print "empty"

- 0of 0 votes
Check if the string is a panagram & print all the missing characters if the string is not a panagram in sorted order.

- 0of 0 votes
Find the winning hand in Poker. I was given input for 2 hands(eg 6D 7D 8H 9H JS 5S 6C JH QD KC), of which I need to determine who won based on the cards & if there is a tie it should print none.

- 0of 0 votes
how to implement the standard JSON.stringify and JSON.parse method

- 0of 0 votes
Given a list of input tasks to run, and the cooldown interval, output the minimum number of time slots required to run them.

// Tasks: 1, 1, 2, 1, 2

// Recovery interval (cooldown): 2

// Output: 8 (order is 1 _ _ 1 2 _ 1 2 )

Whats the time and space complexity ? What's the ideal case of space complexity ?

- 0of 0 votes
Y can't user mode helper function execute ls command .

It is executing my application and even power off command.

Please let me know how user mode helper function works briefly...

- 0of 0 votes
design a zigzag iterator, implement the prev() and hasPrev function

- -4of 4 votes

- -3of 3 votes
IS CARDIO TRAINING NECESSARY FOR WEIGHT LOSS?

- 1of 1 vote
Write a program to return nearest elements from a binary search tree for input element.

- 0of 0 votes
There is a dictionary already implemented. Write a method , which takes input String without space, to replace the characters from the strings which are not present in dictionary with –

Example: Dictionary – a*

………….Input- aaabaa

………….Output- aaa_aa

- 0of 0 votes
There is a dictionary already implemented. Write a method, which takes input String without space, to prints all subsets of the input string which is present in dictionary.

Example: Dictionary – a*

………….Input- aaabaa

………….Output- a,a,a,aa,aa,aaa,a,a,aa

- 0of 0 votes
Write a software test case for even numbers ??

-80 = even number

2 = even number

etc

- 0of 0 votes
Fibonacci asked if you want to query 1-2 ^ 32 any one but the memory can only remember 2 ^ 20 number of how to do O (1) query

- 0of 0 votes
on a bench, sitting a number of people, and now come up a person, how to find a seat that is farthest from other people,

- 0of 0 votes
0 change to 01,1 change to 10.

Line 0 is 0, the first line is 01, the second line is 0110, the third line 01101001. . . Keep asking what is the vale at kth row and jth col

- 0of 0 votes
Assuming your budget is N, you need to buy a rectangular land. Give a matrix of land prices and ask what is the largest area available for buying land. Land prices must be non-negative. For example, the budget is 11.

`1 2 3 1 0 1 4 2 1 9 10 4 The output should be. 1 2 3 0 1 4`

Such a matrix, because 1 +2 +3 +0 +1 +4 = 11. And the largest area.

- 1of 1 vote
The grid is n by m. Each cell contains a unique number on it. Maga is at the left-top and wants to go to right-bottom. But there is a condition. Maga can go through only two way - right and down. And the path of your move is called the nodes you have passed through over them. The path is called the most beautiful if the following condition is satisfied: The sorted of the path has to be lexicographic smallest as possible as. Output the most beautiful path for given grid.

Input:

In the first line you are given two numbers: the dimensions of grid - n and m. The next n lines contains m numbers. Each number is unique.

Output:

Output the most beautiful path.`4 2 3 1`

Return 1 2 4

There are 2 ways to reach at (2,2) cell. The pathes are 4, 3, 1 or 4, 2, 1 respectively. So The most beautiful of them is 4, 2, 1 because if looking the sorted of them it looks like these : 1, 3, 4 and 1, 2, 4 respectively. So 1, 2, 4 is lexicographic smaller than the other. So the ans is 1 2 4.

- 0of 0 votes
There is a door to enter a restroom. Once you enter the restroom there are N toilets starting from 1, 2,... to N. The toilet which is near to entry door starts from 1 and then it serially goes till N. You can use toilet based on below conditions:

1. If none of the toilets are occupied then choose one which is nearest to the entry door(which is toilet#1).

2. If at least one toilet is occupied then choose that unoccupied toilet which is farthest from the occupied ones.

3. If there are more than one unoccupied toilets whose farthest distance from the occupied ones are same then choose one which is near to the door.

For example:

Let's say there are 5 toilets.

-> First person comes and occupies toilet#1(Based on rule#1).

-> 2nd person comes and occupies toilet#5(Based on rule#2).

-> 3rd person comes and occupies toilet#3(Based on rule#2). Note that the farthest distance would have been formed when the new person would have occupied toilet#2(or toilet#4) but with that, the distance between toilet#2(unoccupied) and toilet#1(occupied) would be just 1.

-> 4th person comes in. Now from toilet#1 to toilet#5, only toilet#2 & toilet#4 are unoccupied. Now there are 2 toilets(#2 & #4) whose farthest distance from unoccupied ones are equal(=1). So rule#3 will apply and toilet#2 will be occupied.

You have to find the sum of those toilet numbers which are occupied.

So in above example after 4th person, toilet numbers which are occupied are #1, #5, #3 & #2.

So answer would be 1+5+3+2 = 11.

- 0of 0 votes
Two binary tree, to determine whether the two trees "similar", similar refers to the corresponding node in each tree in the left child and right child can be the same or in the opposite order, such as the following two trees, D, E where DE And DE can also be DE and ED, BC is the same, but the parent child relationship must be the same.

Followup is if left and right can be the same how to do,`A / \ B C / \ D E A / \ C B / \ D E`

- 0of 0 votes
Find valid bracket from provided string. Only { [ ( are involved as brackets. A valid bracket contains with a enclose companion.

Example: {} is valid, [[] Invalid

Input: {[()]}[]() Result: Valid

Input: {}[]()( Result: Invalid

- 0of 0 votes
windows customer toll free number ― 1800-653-1176 ― microsoft windows customer service number

- 0of 0 votes
windows technical support number ― 1800-653-1176 ― microsoft windows technical support number ― G/Irux

- 0of 0 votes
Contact: 1-800-653-1176 Norton™ Activation Customer Care Number

- 0of 0 votes
given n player competition, a bool canbeat (int a, int b) can return a whether beat b. Asked to return a sequence, the sequence only requires two adjacent to the front beat behind. Example, 1 beat 2, 2 beat 3, 3 beat 4, 3 beat 1, 4 beat 1 You can return "1234", that is, although 3,4 can beat 1, but not adjacent does not matter

- 0of 0 votes
Give a two-dimensional array, which represents the value of the jump to the four directions, asked whether from the upper left corner to the lower right corner, follow up the shortest distance

- 0of 0 votes
To A and B two list, B is A shuffle obtained, find the mapping used shuffle,

To be able to handle duplicate elements.

Follow-up: Requirements space O (1),

- 0of 0 votes
list, push is pushed to the head, pop return each element with the same probability. If you push a sorted list into it, how to pop a sorted list out. Follow-up, asked if pop is from head, and push each element with the same probability in any position, how pop a sorted list out?

- 0of 0 votes
Determines whether two strings containing backspace keys are the same.