Programming Skills Interview Questions
- 0of 0 votes
AnswersWe are given a graph of N nodes. (1-N), where each node has exactly 1 directed edge to some node (this node can be the same node).
We need to answer the queries of type : A, B, which asks time required when 2 objects collide if one start at A and other start at B. Both moves 1 hop in 1 sec. If it's not possible for them to collide time would be -1.
Time : from X -> to Y : 1 hop = 1 second.
Constraints :
N, Q <= 10^5 (number of nodes, number of queries).
Example : for given graphA -> B -> C -> D -> E ^ | K <- F
Query(A, E) : 3 seconds, as at time t = 3 secs they both will be on node D.
- tusharrawat831 December 02, 2021 in United States
Query(C, D) : -1 seconds, as they will never collide.
Brute force will take O(Q * N) time. Can we do better than that?| Report Duplicate | Flag | PURGE
Hi5 Software Developer Programming Skills - 0of 0 votes
AnswersQ.1 Rather than separate T[1…m] into two half size arrays for the purpose of merge sorting, we
- ninjaaarashi May 23, 2020 in United States
might choose to separate it into three arrays of size x%3, (x+1)%3, and (x+2)%3, to sort each of
these recursively, and them to merge the three sorted arrays. Give a more formal description of
this algorithm and analyze its execution time. Justify your answer with example.| Report Duplicate | Flag | PURGE
Algorithm Arrays Data Structures Programming Skills - 0of 0 votes
AnswersWrite a binary calculator for summing two strings. Could not use standard {{ bin }} method.
- ito ogami November 20, 2019 in United States| Report Duplicate | Flag | PURGE
Pinterest Software Developer Programming Skills - 0of 0 votes
AnswersGiven a wall, which is made up of two types of bricks (Porus / opaque ). Porus bricks allow water pass through them. Opaque won't. Find whether water reaches to ground, if there is any rainfall.
- gopi.komanduri June 11, 2018 in India for Office
Water can flow from top to bottom, diagonally, horizontally as well. Only flowing from bottom to top is not possible.| Report Duplicate | Flag | PURGE
Microsoft SDE-3 Algorithm Arrays Brain Storming Coding Data Structures Dynamic Programming Problem Solving Programming Skills - 0of 0 votes
AnswersConvert an Integer to a String.
- anonymous December 10, 2017 in India for Office365
eg 10--->"10",
2.5--->"2.5"
+10--->"+10"
-10----->"-10"
1.25e-7--->0.000000125| Report Duplicate | Flag | PURGE
Microsoft SDE1 Programming Skills - 3of 5 votes
AnswersPhone screen Q: String encoding and decoding: Design a method that converts a list of strings into a single string which can be later converted back to the list.
- aonecoding January 15, 2017 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Programming Skills - 0of 0 votes
AnswersFunction to find if the characters of the sample string is in the same order in the text string. They need not be
- krish December 03, 2016 in United States
consecutive.
Eg.. TextString: Redmond, Washington
Sample string :Rdd Waitn| Report Duplicate | Flag | PURGE
Student freshers Programming Skills - 0of 0 votes
AnswersAs you know, Computers were invented to solve practical business problems, we tend to ask practical applied questions. One of the key areas where we want to apply computers is simulation. As most of the people working in software are Engineers, here is the problem. It is called 3 body problem.
- NoOne October 15, 2016 in India
3 Bodies with masses [ m1, m2, m3 ] are initially positioned in the 3 points in the space, thus, having positions [ P1, P2, P3 ].
Observe that each Pi is nothing but [ xi, yi, zi ].
Once the initial condition is set, definitely gravity would work and they would start falling against each other. Write code to simulate this problem. Imagine G, the constant of gravity as 1.
How do you go about simulating it?
Hint : feynmanlectures.caltech.edu/I_09.html see 9.5
Face to face. Pen and Paper. Panel Interview, 2 person Panel. 60 Minutes. For Engineers only, was specifically told about it.| Report Duplicate | Flag | PURGE
Software Developer Algorithm Computer Science Graphics Math & Computation Programming Skills - 0of 0 votes
AnswerAs you know, every OS comes up with this tiny application called the calculator. It is good. Now, here is our problem. If we try to implement the function
def calculate( operand, operator, operand ) { /* Do Interviewers bidding here */ }
I have to write if upon if upon if upon if to do for all operators. Moreover, some operators are not even binary! Take example the abs() or say the negate()!
- NoOne October 14, 2016 in India
Bigger problem persists. With the if mode, we can not even add operators as we wish to without changing code!
But that is a sin. So, what do we do? That is question 1.
In question 2, as a software tester, how do you propose to test and automate the above? Writing more if than the developer is not allowed.| Report Duplicate | Flag | PURGE
SDET Algorithm Data Structures Object Oriented Design Programming Skills Software Design - 0of 0 votes
AnswersProgram- Metrics- Find Kth position in metrics in N X N metrics in spiral form
- Mallikarjun Birajdar September 18, 2016 in India for Kindle| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Programming Skills - 0of 0 votes
Answers"aabcbcbdcc" you can remove and shuffle characters, find the maximum length of string which forms palindrome.
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
like "ccabdbacc"| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Programming Skills - -1of 1 vote
Answers3. Write a program to display numbers having sum of left side numbers equal to right side numbers.
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
{1,0,-11,1,12}=>0 {Left side number 1+0=1, Right side number -11+1+12=1}| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Programming Skills - 0of 0 votes
Answers2. Write a program to diplay a character occurred maximum times and if two charaters occurring same no of times then display 1st character in string.
- Mallikarjun Birajdar September 18, 2016 in India for Kindle
"HELLO WORLD!" display L
"HO HELLO!" display H (H, L and O appeared 2 times but H is in 1st in string)| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Programming Skills - 0of 0 votes
AnswersThis was the first round. A written test. I was asked to write a complete program that can execute with proper syntax. Also comment on the complexity and add comments to code where necessary. And i had to write it on Paper. Three questions were given and was asked to answer any two. I was given 1hr time for this.
- uday4friendz March 04, 2016 in India for Product Details Page
This was one of the questions
Q) You are given a BST and a number k. Find the node in the tree which has the value closest to k.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Programming Skills - 0of 0 votes
AnswersThis was the first round. A written test. I was asked to write a complete program that can execute with proper syntax. Also comment on the complexity and add comments to code where necessary. And i had to write it on Paper. Three questions were given and was asked to answer any two. I was given 1hr time for this.
- uday4friendz March 04, 2016 in India for Product Details Page
This was one of the questions.
Q) You are given a linked list and two integer nums 'm' and 'n'. Retain 'm' elements and delete 'n' elements. Do this repeatedly till the end of the linked list.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Programming Skills