unknown Interview Questions
- 0of 0 votes
AnswersSouthwest Airlines Vacation Packages
- willyoungjr1 August 08, 2023 in United States for https://www.skywayfare.com/vacation/southwest-airlines-vacation-packages/| Report Duplicate | Flag | PURGE
unknown job tessio web development - 10of 10 votes
AnswersThere is a 2D matrix of 0s and 1s that depicts the number of rooms that can be formed by a co-working space company like WeWork based on the values. 1 means open space for room and 0 means wall. We need to group as many 1s and possible to form the largest and minimum number of rooms.
- Jigisha Aryya December 25, 2019 in India
E.g.
Number of Rows = 5, Number of Columns = 5
00010
01110
01100
01101
00011
Output: 4
Input 2:
4
3
001
111
011
100
Output: 4| Report Duplicate | Flag | PURGE
unknown Backend Developer Algorithm - 0of 0 votes
AnswerGiven a square (n x n) matrix which only contains 0 and
- danishm026 September 29, 2019 in India
1. Find the minimum cost to reach from left most column to rightmost column.
Constraints/rules:
a. Starting point: You can start from any cell in the left most column i.e. (i, 0) where i can be between 0 and n( number of rows/ columns)
b. Destination: You can reach any cell in the rightmost column i. e ( k, n) where k can be anything between 0 and n.
c. You cannot visit a cell marked with 0.
d. Cost is defined as the sum of cells visited in path.
e. You can move up, down, left and right but not diagonally.
For example,
take 2x2 matrix
1 | 0
1 | 1
One possible path is 00 -- 10 -- 11 with cost 3
Other one is 10 -- 11 with cost 2
so minimum cost on this case is 2.| Report Duplicate | Flag | PURGE
unknown Random Algorithm Data Structures - 0of 0 votes
Answeryou are provided a binary array, and a integer k, choose any k bits of array at a time and flip all the bits, maximize the number of '1's in array.
- aaa June 11, 2019 in United States| Report Duplicate | Flag | PURGE
unknown Student - 0of 0 votes
AnswersI am given an array of Transactions in a ledger. A Transaction object has three things.
- goyalshub February 16, 2019 in United States
1. Sender (which means who started this transaction)
2. Receiver (means who is the destination of transaction)
3. Timestamp (at what time this transaction was executed)
Now I need to write a method findIfTransactionIsValid() which will have the array of all transactions, one sender, one receiver. A transaction is valid is following cases:
1. if sender and receiver are same
2. The timestamp should be increasing (what I mean here is if A -> B happens at Time 2 and B-> C happens at Time 1, then A->C is not a valid transaction, however if B -> C happens at Time 3 then A--> C is a valid transaction)
Example:
Transaction
{
Sender;
Receiver;
Timestamp;
}
Example: [T is timestamp here]
A -> B (T=0)
B -> C (T=1)
C -> F (T=0)
findIfTransactionIsValid(A, C) -> this should return true
findIfTransactionIsValid(B,F) -> false (time is backwards)
If the question is still not clear, please see the solution I wrote. I have written a recursive solution and is working but I am seeing help to improve the solution.| Report Duplicate | Flag | PURGE
unknown Software Engineer Algorithm - 0of 0 votes
AnswersThere are 4 closed boxes and one of them has $100 inside. You can open one of the boxes if you pay x dollars.
- sashanksatya January 30, 2019 in United States
If the box you opened is empty, you can keep on opening boxes, but you need to pay x dollars every time.
Up to what amount would you pay?| Report Duplicate | Flag | PURGE
unknown Data Scientist Probability - 0of 0 votes
AnswersDatabase query response times have increased. An API which is dependent on this database will see - *
- __Joker October 10, 2018 in India
This is a multi-select answer.
Increase in the latencies.
Increase in RAM utilisation on the API servers
Increase in CPU utilisation on the API servers
Increase in 200 response codes
Increase in 5xx responses| Report Duplicate | Flag | PURGE
unknown Software Developer Software Design - 0of 0 votes
AnswerSetting a value in cache is failing. What are the acceptable production practices? *
- __Joker October 10, 2018 in India
1. Raise an exception immediately
2. Retry in equal intervals of time until the set call succeeds
3. Retry with exponential back off until the set call succeeds
4. Retry 2 or 3 times with exponential back off.
5. Retry 2 or 3 times with equal intervals of time.
This is a multi-select question.| Report Duplicate | Flag | PURGE
unknown Software Developer System Design - 0of 0 votes
AnswerWe have a database that allows 2 concurrent writes and 3 concurrent reads. Each read/write operation takes 10ms to complete. What is the time taken to process all the requests in the orders mentioned (all requests can be assumed to be coming in at the same instant of time and are operating on a single row in a table) - 1. write, write, read, write, read, read, write, read 2. read, write, read, write, read: *
- __Joker October 10, 2018 in India
1. 30 ms 2. 10ms
1. 60 ms 2. 10ms
1. 10 ms 2. 10ms
1. 20 ms 2. 10ms
1. 10ms 2. 20ms
1. 60ms 2. 30ms| Report Duplicate | Flag | PURGE
unknown Software Developer Database - -2of 2 votes
AnswersGoogle Technical Support Number & Support Service
- roberthenry5678 September 06, 2018 in United States
For google related errors issues call on google customer service 1888-809-3891 toll free number for any google related problems such as how to reset gmail password,how to change google account youtube settings etc.For any google related help dial given toll free number for solution.
http://www.supportcarenumber.com/blog/how-to-you-contact-google-technical-support| Report Duplicate | Flag | PURGE
unknown Software Architect - 0of 0 votes
AnswersGiven integer m and n where n is odd, for all mxn matrixes that consist of 0 and 1, find the one that has max count of 1s and meets following conditions:
- akak18183 August 31, 2018 in United States
1. All 0s are connected;
2. All 1s are adjacent to at least one 0 (Adjacent includes diagonal line adjacent, 8 directions);
3. maxtrix[m-1][n/2] = 0.
Example :
Input: m=2, n=3
Output: [[1,1,1],[1,0,1]]
Follow up:
Given another list of 'blocked' points. Matrix will set those points to -1 and you cannot change that. Solve the problem again.| Report Duplicate | Flag | PURGE
unknown Software Engineer Algorithm - 0of 0 votes
AnswersWrite a function that given a string would print the 'expanded' version of it.
For example a2[bc2[c]]d would print out abcccbcccd
Note:
The number before the opening and closing square brackets is the multiplier for the characters within the square brackets
Method Signature [Java]:
- btmakusha January 07, 2018 in United Statespublic String expanded(String str)
| Report Duplicate | Flag | PURGE
unknown Software Engineer - 0of 0 votes
AnswersWrite a software test case for even numbers ??
- mans December 22, 2017 in United States
-80 = even number
2 = even number
etc| Report Duplicate | Flag | PURGE
unknown Testing / Quality Assurance - 0of 0 votes
AnswersCreate a SQL-like language parser that manipulates directories and files (The compiler/parser may be created in any other language).
To summarize, I want you to create a "file and directory manipulation language" with the following rules/syntax (you may create another commands):
CREATE DIR <path>
CREATE FILE <name> IN <path> [WITH <data>]
'WITH' insert the <data> in the file on the fly, but it's optional
GET DATA FROM <path/to/file>
Examples on how this language may be used:import FDML ex = "Hey guys" data = FDML.get('GET DATA FROM "./path/to/file"'); FDML.statement("""CREATE DIR "./imgs"; CREATE FILE "test.txt" IN "./path/to/dir""") FDML.statement('CREATE FILE "welcome.txt" IN "./path/to/dir" WITH "{}"'.format(ex)) print(data)
Or those commands can be run in a shell:
- lopogax December 15, 2017 in United States
> fdml "CREATE DIR './dir'"
> /dir was created!| Report Duplicate | Flag | PURGE
unknown Software Engineer parsing - 0of 0 votes
AnswerI have applied for Software Engineer at a startup company in India, I have asked the following question.
- s.lokesh1729 December 04, 2017 in India for Engineering
You are building an application with ORM model say django, you have set of models, urls. Let's say an user is hitting api /user/account/profile/xxx/yyy like this. You have to check whether user has permission to access or not. If user has access to /user/ then he has access to the whole URL, like wise if he has access to /user/account/ he has access to whole URL. User table looks like below and it has a field called prefix which contains URL prefix of that particular user.
Users
userid | prefix | username | firstname | lastname
1 /user/ lokesh1729 lokesh sanapalli
2 /user/account lokesh1729 lokesh sanapalli
What is the most efficient way to check if a particular user has access to an API or not???
I gave a brute-force approach that first we will check if he has access to /user/ then /user/account then /user/account/profile and so on, if he has access to a prefix and we will process the request.
He is not satisfied with the answer. Can anyone tell me what might be the answer for this???| Report Duplicate | Flag | PURGE
unknown Software Engineer design - 0of 0 votes
AnswerThe question which has been asked is : how to share a variable across two unrelated process in Linux without using IPC.
- S@iR@m November 29, 2017 in India| Report Duplicate | Flag | PURGE
unknown Software Engineer / Developer Unix - 0of 0 votes
AnswersThe question which has been asked to me is : Print right angle triangle with stars(*) without nested loops. Implement in C programming language.
- S@iR@m November 29, 2017 in India| Report Duplicate | Flag | PURGE
unknown Software Engineer / Developer C# - 0of 0 votes
AnswersGiven a string S(a data structure) that contains only square brackets, convert it to an array that stores arrays in the following format: [positionOpeningBracket, positionClosingBracket, nestedDataStructure]. Example: https://i.imgur.com/vZhlZdr.png
- lopogax October 29, 2017 in United Statesdef parser(S): #whatever... print(r) parser("[[]][]") #output: [[0,3,[1,2,null]], [4, 5, null]]
| Report Duplicate | Flag | PURGE
unknown Software Engineer Problem Solving - 0of 0 votes
AnswersYou are given a tree and any of the leaf node which is given as input is set to fire. And in each unit time all the neighbouring nodes of the nodes which are already in fire also catch fire. Given a tree find the time taken for the whole tree to catch fire.
- manikadanmanio October 10, 2017 in United States
The whole catches fire meaning all nodes catches fire.
Example :
4
/ \
5 6
/ \ / \
7 8 9 10
\ \
13 11
\
12
Assume the source leaf node : 9
At 1 sec : 6 catches fire
At 2 sec : 10 and 4 catches fire
At 3 sec : 5 catches fire
At 4 sec : 7 and 8 catches fire
At 5 sec : 13 and 11 catches fire
At 6 sec : 12 catches fire
If we have access to parent pointers its easy just BFS and keeping track of visited we get the answer.
How to go about the problem if we do not have access to parent pointers ??| Report Duplicate | Flag | PURGE
unknown Software Engineer / Developer Problem Solving - 0of 0 votes
AnswersGiven a array of integers there is one that is repeated several time. How would you compute the length of the sequence of repeated elements.
- Fernando May 29, 2017
Assuming the initial array is sorted can you do better than O(n) both for spatial and temporal cost?| Report Duplicate | Flag | PURGE
unknown Software Engineer Coding - 0of 0 votes
AnswersYou are given 20 questions to solve in 20 minutes.
- NoOne October 14, 2016 in India
If you successfully solve the question, you would receive 2 marks.
If you failed to solve the question, and you do not try it ( let it untouched ) , you would receive 0 marks. If you solve it wrong ( i.e. not the correct answer ) - you would receive -1 ( negative) .
With the story, here are the problems:
1. Write an algorithm, which, given an input array ( set ) of questions, and varying probability ( 0 <= p <= 1 ) of can do and can not do per question, generates a strategy for solving the paper to generate maximum expected pay off.
2. Given the question paper is multiple choice, between 4 choices ( a,b,c,d ) do a bias analysis ( e.g. if more a's are coming than 'c's ), and decide if you would like to probabilistically take risk and mark some to increase pay off.
Obviously, you can get a maximum 40, and a minimum -20.
3. Now, put yourself in the position of the examiner, and try to ensure it is almost impossible to increase payoff by random selection over the questions. Try to negate the bias. That is question 3.
In all 3 cases write an algorithm. Face to face interview, time allocated was 60 minutes. Panel Interview.| Report Duplicate | Flag | PURGE
unknown SDET Algorithm - 0of 0 votes
AnswersConsider a string A containing exactly X characters. A variant of A, A(k), can be obtained by doing a cyclic shift of A starting from position k (0 <= k < X). The number of characters after the shift in A(k) will remain the same as they were in A. Every j-th character (0 <= j <= X-1) of A(k) is equal to (k+j)%X character of A. We will call A a classic word if there are exactly M positions k such that A(k) = A
- Abhishek.Mathur.CA September 30, 2016 in United States
You are given array Q containing exactly R strings. For each permutation s = (s[0], s[1], ..., s[R-1]) of integers between 0 and R-1, inclusive, we can define a string generated by this permutation as a concatenation Q[s[0]] + Q[s[1]] + ... + Q[s[R-1]]. Find the number of permutations that generate classic words. All indices in this problem are 0-based
Constraints
Set Q will contain between 1 and 8 elements, inclusive. Each element will have 1 to 20 characters, inclusive
M will be between 1 and 200, inclusive
Input Format
Line 1: comma separated strings representing set Q
Line 2: Integer M
Output Format
Number of permutations that generate classic words
Sample Input
CD,QCCD,QC
2
Sample Output
3
Explanation
The classic words are "CDQCCDQC" and "QCCDQCCD". Permutation 0, 1, 2 generates the first, and 1, 2, 0 and 2, 0, 1 generate the second| Report Duplicate | Flag | PURGE
unknown Software Developer - 0of 0 votes
AnswersYour friend has invented a new compound consisting of N elements. However, he has forgotten the amount of each element that goes into the recipe.
- Abhishek.Mathur.CA September 30, 2016 in United States
For N-1 pairs of elements, he remembers the proportion in which the elements within each pair should be added to the compound. Fortunately, these N-1 proportions are sufficient to restore the recipe of the entire compound.
You are given N-1 proportions as String. Each String is formatted "#<a> and #<b> as <p>:<q>" (quotes for clarity), which means that the mass of element <a> divided by the mass of element <b> in the cocktail must be equal to <p>/<q> (all elements are 0-indexed). Print exactly N elements, where the first line is the mass of element 0 and second line is the mass of element 1 and so on... such that all the given proportions are satisfied and the total mass is as small as possible. The total mass must be greater than 0.
Input
Line 1: N
Line 2 .. N: proportion_i
Output
N lines of masses, as stated in the problem statement
Input Explanation
Line 1: N, the number of elements
Line 2 to line N: N-1 proportions, format described in the problem statement
Output Explanation
Output will contain exactly N lines, each line is the mass of the element such that all the given proportions are satisfied and the total mass is as small as possible. The total mass must be greater than 0.
Sample Input
3
#0 and #1 as 9:8
#1 and #2 as 9:8
Sample Output
81
72
64| Report Duplicate | Flag | PURGE
unknown Software Developer - 0of 0 votes
AnswersConsider a social website SocialX, where friends connect to each other, just as they do on Facebook
- Abhishek.Mathur.CA September 30, 2016 in United States
Friendship on SocialX is symmetric (if X is a friend of Z, then Z is also a friend of X) however not transient (if X and Z are friends and Z and Y are friends, then X and Y are not necessarily friends)
The term "k-joined" is defined as follows. If two people are friends, they are called 1-joined. For k >= 1, two people X and Z are called (k+1)-joined if X and Z are k-joined, or if there exists a person Y such that X and Y are k-joined and Y and Z are friends.
"Approachable Score" is defined as follows. If two people X and Z are not friends, then their Approachable Score is the fewest number of people (other than themselves) who must be removed from the network in order for X and Z to not be 3-joined. The higher the Approachable Score, the more likely it is that X and Z know each other.
Given a set of friends containing exactly K elements, where K is the number of people in the network. People are numbered from 0 to K-1. The j-th character of the i-th element of friends is '1' if i and j are friends, and '0' otherwise. Return the Approachable Score for personX and personZ
Constraints
Set of friends will contain exactly K (1 < K < 41) elements, where each element will contain exactly K characters. Each character will either be '0' or '1'
friends[i][j] will always be equal to friends[j][i] and friends[i][i] will always be equal to 0
friend[personX][personZ] will be equal to 0 and personX will never be equal to personZ
Input Format
Line 1: comma separated K elements representing friends
Line 2: Integer representing personX
Line 3: Integer representing personZ
Output Format
Integer representing Approachable Score
Sample Input
0100,1010,0101,0010
0
3
Sample Output
1
Explanation
Either remove person 1 or person 2 to get an Approachable Score of 1 for person 0 and 3| Report Duplicate | Flag | PURGE
unknown Software Developer - 1of 1 vote
AnswerYou are given a list of tasks as an integer array, task_costs. Every i-th element of task_costs represents a task and requires task_costs[i] seconds to complete. All tasks listed in the array are independent of other tasks.
- Abhishek.Mathur.CA September 18, 2016 in United States
It is required to finish all the tasks independently and as soon as possible. You are given a single worker robot to start taking the tasks and finish them one at a time. However if you like, you can divide the worker robot in two. Each resulting robot can then be further divided into two and so on. There is a cost, in seconds, of dividing a robot in two, represented by robot_divide_cost.
You can assign an independent task to any available robot, however you can't interrupt or divide a robot while it is working on the assigned task. At the same time you can't assign a task to any robot while its in the process of getting divided.
To keep things simple you can't allow multiple robots to work on the same task. At any given time only one robot can work on a task and finish it. Once any particular robot finishes a task it can't be assigned any further tasks.
Given a list of tasks and cost of dividing a robot, find the least amount of time to finish all tasks.
Input:
3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,360,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600,3600
3600
Expected Output: 25200
Input:
1113,773,824,822,1458,1257,908,1320,780,1016,1066,861,1150,718,1405,738,718,980,1037,946,1121,1349,805,1378,1308,1272,1532,779,875,1392,982,1282,744,723,1033,1067,1158,1071,742,683,678,762,686,1143,862,1231,765,1472,1560,1085
3147
Expected Output: 20040| Report Duplicate | Flag | PURGE
unknown Software Developer - 0of 0 votes
AnswersYou are given a string X and integer k (0 <= k < length of X). For each value of k you can look at a sub-string of X starting from index 0 to index k and choose to reverse it. As an example, let X = LMNAP and k = 2. If you reverse the sub-string of X between 0 and 2 you will get NMLAP. Subsequently if choose k = 3 and reverse you will end up with ALMNP.
- Abhishek.Mathur.CA September 18, 2016 in United States
Given the string X as an input find lexicographically earliest possible string. In the example above, lexicographically ALMNP comes earlier than NMLAP.
Input:
AACAACAABBABACAACBCACCCAAABACABACACCBCCAAABABACBCC
Expected Output: AAAAAAAAAAAAAAAAAAAAAAACCBBBCCBCCCCBCBCCCBCCBBCBCC
Input:
BACBCBCACAACBCBBCCBACCCCAACCBCCAABACAABCAAAABBAABC
Expected Output: AAAAAAAAAAAAAAAAAABCBCBCCCBCBBCCBCCCCCCBCCBCBCBBBC| Report Duplicate | Flag | PURGE
unknown Software Engineer / Developer - 0of 0 votes
AnswersHow to print from 3rd column to till last columns using awk command in unix, if there are 'n' columns in a file.
- Srinivas August 29, 2016 in United States| Report Duplicate | Flag | PURGE
unknown xyz - 0of 0 votes
AnswersGiven a matrix of ‘O’ and ‘X’, find the largest sub rectangle surrounded by ‘X’
- vinay February 26, 2016 in United States
Example :
XXXXX
X0X0X
XXXXX
XXXXX
Output : largest rectangle size is 4 x 5| Report Duplicate | Flag | PURGE
unknown Developer Program Engineer Algorithm - 0of 0 votes
Answers
- Desi Joe December 22, 2015 in United Statesinterface RangeContainerFactory { /** * builds an immutable container optimized for range queries. * Data is expected to be 32k items or less. * The position in the “data” array represents the “id” for that instance * in question. For the “PayrollResult” example before, the “id” might be * the worker’s employee number, the data value is the corresponding * net pay. E.g, data[5]=2000 means that employee #6 has net pay of 2000. */ RangeContainer createContainer(long[] data) } /** * a specialized container of records optimized for efficient range queries * on an attribute of the data. */ interface RangeContainer { /** * @return the Ids of all instances found in the container that * have data value between fromValue and toValue with optional * inclusivity. The ids should be returned in ascending order when retrieved * using nextId(). */ Ids findIdsInRange(longfromValue, long toValue, boolean fromInclusive, boolean toInclusive) } /** * an iterator of Ids */ interface Ids { /** * return the next id in sequence, -1 if at end of data. * The ids should be in sorted order (from lower to higher) to facilitate * the query distribution into multiple containers. */ static final shortEND_OF_IDS = -1 short nextId() } Validation: Your implementation should pass the following simple JUnit test before you start tuning for performance with volume data: public class RangeQueryBasicTest { private RangeContainer rc @Before public void setUp(){ RangeContainerFactory rf = new YourRangeContainerFactory() rc = rf.createContainer(new long[]{10,12,17,21,2,15,16}) } @Test public void runARangeQuery(){ Ids ids = rc.findIdsInRange(14, 17, true, true) assertEquals(2, ids.nextId()) assertEquals(5, ids.nextId()) assertEquals(6, ids.nextId()) assertEquals(Ids.END_OF_IDS, ids.nextId()) ids = rc.findIdsInRange(14, 17, true, false) assertEquals(5, ids.nextId()) assertEquals(6, ids.nextId()) assertEquals(Ids.END_OF_IDS, ids.nextId()) ids = rc.findIdsInRange(20, Long.MAX_VALUE, false, true) assertEquals(3, ids.nextId()) assertEquals(Ids.END_OF_IDS, ids.nextId()) } } FAQ Can't we just use a B-Tree/ NavigableMap/HashTable/BinarySearch/Lucene... Sure, if you want. But there are a number of things we'd like to achieve: ● The container will be in memory and will need to hold lots of data, so we'd like it to be as space efficient as possible, but not to the extent where speed is significantly compromised. Speed is king, memory/disk can be purchased. ● Since we hate collecting garbage, we need to be careful about memory allocation during a query, as my grandmother told me, "allocate not, gc not". ● Code should be clear and understandable. ● The rough order of trade off to consider for this case is: search performance, efficient usage of memory, simplicity and maintainability of the code These objectives are often at odds - we'd like to explore what's possible.
| Report Duplicate | Flag | PURGE
unknown Software Developer Algorithm