.Net/C Interview Questions
- 0of 0 votes
AnswersSmallest string
- sobby May 03, 2020 in India
You are given the following :
1. Two strings S and T each of Length N
2. K Pairs of integers L(i) and R(i) (0 <= l(i) < R(i) <= N-1)
You can perform any of the following two operations any number of time.
1. You can replace the character of string S at the ith position with the character of string T at the ith position
2. You can select from any provided K pairs and you are allowed to swap characters at position L(i) and R(i) in string T
Now, you are required to perform all the operations optimally so that string S can be lexographically smallest.
All characters of S and T are of lowercase English letters and there are only two ways to perform all the operations either(111...1) then (2222...2) or (2222...2) then (1111.1)
Input Format :
1. First line contains number of test cases:
2. Second line contains the lengths of string and the number of pairs of integers.
3. Next two line contains S and T two strings.
4. The next K lines contains the space separated integers.
Sample Input :
1
8 4
abagfiab
cbacbcda
0 1
1 2
3 4
4 5
sample output : aaabccaa| Report Duplicate | Flag | PURGE
PayPal SDE-3 Algorithm - 0of 0 votes
AnswersYou are given a list of n people and also a list of m pairs who know each other.
- ff987456321 April 25, 2020 in France
Here is an example input:
List of people: x1, x2, x3, . . . , xn
People who know each other: (x1, x2),(x1, x4),(x2, x4),(x2, x5),(x2, x6),(x4, x5),(x4, x6), . . .
1. Given a positive integer k, write an integer program that finds k people among the given n people with
the maximum number of pairs who know each other. How many variables and constraints are there?
2. Write an integer program that finds the maximum number of people where everyone knows each other. How many variables and constraints are there?| Report Duplicate | Flag | PURGE
Algorithm - 0of 0 votes
AnswersYou are given 2 arrays: one representing the time people arrive at a door and other representing the direction they want to go(in or out) You have to find at what time each person will use the door provided no 2 people can use the door at the same time. Constraints: the door starts with ‘in’ position, in case of a conflict(2 or more people trying to use the door at the same time), the direction previously used holds precedence. If there is no conflict whoever comes first uses the door. Also if no one uses the door, it reverts back to the starting ‘in’ position. Should be linear time complexity.
- neer.1304 April 21, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven a board game of N x M size. A domino is of size 1 x 2 and can be rotated to make it 2 x 1. A player can place a domino in any of the available position. When a player is not able to place a domino, he loses. An AI is created to play against the user. The AI selects a random position in the board and places the domino there. Improve this AI. What solution will be the best when board size is small and what if the board size is large.
- komorsad2 April 12, 2020 in India
Anyone has any idea how to have a solution to this problem?| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersYou have to find out the number of good strings of length N characters in size which you can make using characters A B and C.
- Garuda April 12, 2020 in United States
A string is a good String if it satisfies the following three criteria:
The total number of C in the string should not be greater than equal to 4.
There should not be more than two consecutive A's in the string.
Any two B's should be at least two characters apart.
How do I find total possible good strings for N length string?
Time constraint of 1 sec for large N| Report Duplicate | Flag | PURGE
- 0of 0 votes
AnswersJava:
- roxanadaniela35 April 10, 2020 in United States
Managing extreme sports locations:
In such locations, are period of the year when this actities can be performed(ski December - February, Kiting May August, ATV all year), each sport /location usually has an average cost/day.
The sports have hierarcal structure and countaind the country, region and city, we need an ADD, REMOVE, UPDATE; GET a location and all its informations.
exemple:
Switzerland:
Zurich:sky(dec, feb), price 12 $
Berna:ATV - all time , price 10$| Report Duplicate | Flag | PURGE
JDA Java Developer Java - 0of 0 votes
Answershow to snake & ladder game
- yatendra.br April 10, 2020 in United States| Report Duplicate | Flag | PURGE
Riot Gaming - 0of 0 votes
AnswersWrite a c program to simulate Bankers algorithm for the purpose of deadlock avoidance.
- computersengineers43 April 01, 2020 in United States| Report Duplicate | Flag | PURGE
- 0of 0 votes
AnswersImplement Producer - Consumer problem using semaphores
- computersengineers43 April 01, 2020 in United States| Report Duplicate | Flag | PURGE
- 0of 0 votes
AnswersWAP to create two threads . One threads check whether
- computersengineers43 April 01, 2020 in United States
the number is even or odd while the second threads finds factorial of a numbers.| Report Duplicate | Flag | PURGE
Algorithm - 0of 0 votes
AnswersWhy Google Duo Not working on iPhone?
- simmigravey March 25, 2020 in United States| Report Duplicate | Flag | PURGE
Tracingpage Problem Setter Google Duo Not Working - 0of 0 votes
AnswersHow to Change Allegiant Air Flight?
- Robert Musk March 25, 2020 in United States| Report Duplicate | Flag | PURGE
travelservicesforyou Site Manager Allegiant Air Flight Change - 2of 2 votes
AnswersI was asked to sort extra large file 10GB which contains single word in each line, within 4GB RAM. I told External sort and optimised it with min-heap but interviewer was asking to optimise disk I/O. As last he told that use CS fundamentals. Don't know what was he expecting. Please help.
- sulabh.shkl March 22, 2020 in India| Report Duplicate | Flag | PURGE
Microsoft Software Developer Algorithm - 0of 0 votes
Answersdeadlock detection is an important consideration in operating system of computer.In this problem you will be given a directed graph representing the state of the system.Your program should detect the whether there are any deadlocks in the system(A deadlock can be created by checking for the cycles in the graph
- swetankkanaujiamk March 21, 2020 in United States
the input will be in the form
process X holds sources Ri and wants resources Rj ( X holds the Rj means an edge Ri->X and X wants Rj means an edge X->Rj).Note that both processes and resources form nodes of the graph.
Use depth first traversal to determine whether they are the cycles in the graph.The graph contains a cycle if while expanding a node ,you encounter a child that is represent in the path from the root of the current tree to the node being expanded .You can assume that the maximum number number of nodes in the graph will not exceed 50| Report Duplicate | Flag | PURGE
C++ - 0of 0 votes
Answersrain strikes and the roads are flooded .Mr x has to get home from work.your task is to make sure he returns home in the shortest time .consider the roads as a graph with crossing as nodes and the path between two nodes as an edge. SAssume the graph is unidirected and the numbers are numbered .1 to v(v<=50)
- swetankkanaujiamk March 21, 2020 in United States| Report Duplicate | Flag | PURGE
Data Structures - 1of 1 vote
Answersfind the maximum length subarray condition 2 * min > max
- samayragoyal990 March 16, 2020 in India| Report Duplicate | Flag | PURGE
Adobe Backend Developer Arrays Coding - 0of 0 votes
AnswersDetect a horizontal line in a bitmap image. Assume there will be some utilities to process the black and white image. you just need to process the utility output and return the start and end indices of the horizontal line if any.
- ammuz February 17, 2020 in Germany| Report Duplicate | Flag | PURGE
Google - 0of 0 votes
AnswersGiving an array of stock prices, find an algorithm of a maximum profit of a series of transactions with a constraint of purchasing one unit at any purchasing transaction.
- fz February 14, 2020 in United States
For example, stock prices
{5, 6, 3, 5, 4, 6, 7}
The transaction sequence would be the following for a maximum profit:
buy on the first day(price 5) and sell on the second day (price 6)
buy on the third day (3) and sell on the 4th day (price 5)
buy on the 5th day and sell on the 7th day (price 7)| Report Duplicate | Flag | PURGE
Software Engineer Algorithm - 0of 0 votes
AnswersA 2d array has 0 and 1 as values. In one flip, 0's are changed to 1 if and only if any of the neighbors (left, right, top, bottom) is 1. Return the total number of flips required to convert the whole grid to 1's
- abhi.mathur.us February 11, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDET - 0of 0 votes
AnswersHi, first of all I want to say thanks to Gayle for the awesome work on the book and online resources. I was reading the introduction section of CtCI and I have a doubt regarding the "remote" preparation to the interview. I see that getting an internship as soon as possible seems to be very important, but I don't understand one thing.
- crackingtothegate February 11, 2020
If one is not able to land an internship at a top company like Google or Microsoft early on, would it be better to still do one at a worse company (like a "consulting" firm or less renown company) or at this point dedicating to personal projects that are more interesting that the job you would do there would be evaluated more?
Also, how should a student not in his final year prepare to be admitted to an internship? I've read that internship selection processes can be pretty selective already, and you wouldn't even have the previous internships as a plus on your resume.| Report Duplicate | Flag | PURGE
Student Experience - 0of 0 votes
AnswersGiven a set of integers, the task is to divide it into two sets S1 and S2 such that the absolute difference between their sums is minimum.
- Anon February 09, 2020 in United States
If there is a set S with n elements, then if we assume Subset1 has m elements, Subset2 must have n-m elements and the value of abs(sum(Subset1) – sum(Subset2)) should be minimum.| Report Duplicate | Flag | PURGE
Salesforce Software Engineer - 0of 0 votes
AnswersIntelligent Substrings:
- himatNIT February 09, 2020 in United States for Hacker rank test
There are two types of characters in a particular language: special and normal. A character is special if its value is 1 and normal if its value is 0. Given string s, return the longest substring of s that contains at most k normal characters. Whether a character is normal is determined by a 26-digit bit string named charValue. Each digit in charValue corresponds to a lowercase letter in the English alphabet.
Example:
s = 'abcde'
alphabet = abcdefghijklmnopqrstuvwxyz
charValue = 10101111111111111111111111
For clarity, the alphabet is aligned with charValue below:
alphabet = abcdefghijklmnopqrstuvwxyz
charValue = 10101111111111111111111111
The only normal characters in the language (according to charValue) are b and d. The string s contains both of these characters. For k = 2, the longest substring of s that contains at most k = 2 normal characters is 5 characters long, abcde, so the return value is 5. If k = 1 instead, then the possible substrings are ['b', 'd', 'ab', 'bc', 'cd', 'de', 'abc', 'cde']. The longest substrings are 3 characters long, which would mean a return value of 3.| Report Duplicate | Flag | PURGE
Linkedin SDE1 - 0of 0 votes
AnswersI'm going to have a webinar in join.me All software can be shared except pvsyst software The time to share the black screen is shown
- Nike.hoss@yahoo.com February 05, 2020 in -| Report Duplicate | Flag | PURGE
techsupport - 0of 0 votes
Answera matrix contains positive integer numbers.
- amitaiweil February 03, 2020 in United States
Each column and row, which contains zero should be reset all to 0.
(The reset column/line should be skipped while iteration)
Is there a way in C for doing this without using another temp full array for knowing where the zero's which have been found exist?| Report Duplicate | Flag | PURGE
None None C - 0of 0 votes
AnswersGiven two sorted arrays, the task is to merge them in a sorted manner.
- Nits January 30, 2020 in United States| Report Duplicate | Flag | PURGE
Brocade Software Trainee - 0of 0 votes
AnswersYou are given a list of n-1 integers and these integers are in the range of 1 to n. There are no duplicates in the list. One of the integers is missing in the list. Write an efficient code to find the missing integer.
- Nits January 30, 2020 in India| Report Duplicate | Flag | PURGE
Deshaw Inc Tech Lead - 0of 0 votes
AnswerWrite an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum.
- Nits January 30, 2020 in United States| Report Duplicate | Flag | PURGE
Akamai Research Scientist - 1of 1 vote
AnswersGiven an unsorted array A of size N of non-negative integers, find a continuous sub-array which adds to a given number S.
- Nits January 30, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon Dev Lead
Open Chat in New Window