veeru
BAN USER
- 2of 2 votes
AnswersWhen a person who knows it meets any other person, they immediately share the story with them.
- veeru in India
Initially, only person 1 knows the story. Given a list of meetings between people in a form of
(person_1_id, person_2_id, timestamp) construct a list of the persons who will know the story
at the very end.
Example: [(1, 2, 100), (3,4, 200), (1,3, 300), (2,5, 400)], 1 // The events could be out of order.
Person 2 will learn the story at the moment 100, person 3 — at the moment 300,
person 5 — in the moment 400. Person 4 will never learn the story. So the answer is [1, 2, 3, 5].
Eg2: [(1, 2, 100), (2, 3, 100), (4, 5, 100)], 2
where the first parameter is array of the Persons meet at particular timestamp, second parameter is the PersonId who knows the story first.
Output: [1, 2, 3]| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Data Structures - 1of 1 vote
AnswersWrite a program to find the given new program can be scheduled or not?
- veeru in United States
Already scheduled Programs: P1(10,5), P2(25,15)
New Programs: P3(18,7), P4(12, 10).
In P1(10, 5), where 10 is the starting time, 5 is the execution time.
As The P3(18, 7) starts at time 18 and executes for 7 mins i.e., the end time is 18+7 = 25. So this time slot is free and there is no overlap with already scheduled programs. Hence P3 can be scheduled.
As the P4 overlaps with P1, So P4 cannot be scheduled.| Report Duplicate | Flag | PURGE
Google Software Engineer Data Structures - 3of 3 votes
AnswersThere are N pots. Every pots have some water in it. They may be partially filled. So there is a Overflow Number 0 associated with every pot which tell how many minimum stone pieces are require for that pot to overflow. So if for a pot 0-value is 5 it means minimum 5 stone pieces should be put in that pot to make it overflow. Initially a crow watched those pots and by seeing the water level he anticipated 0-value correctly for every pot ( that is he knew 01 to On). But when he came back in evening he found that every pot is painted from outside and he is not able to know which pot has what 0-value. Crow wants some K pots to overflow so that he can serve his child appropriately. For overflow of pots he need to search for stone in forest( assume that every stone has same size). He wants to use minimum number of stones required to overflow K pots. But only he know the 0-value of pots he doesn't know now which pot has what 0-value. So the task is that in what minimum number of stones he can make K pots overflow in worst case.
- veeru in India for Development
Input/Output Specifications Input Specification: 1) A array 0 corresponding to 0-value of N pots {01, 02, On} 2) Number of pots 3) K -value ( number of pots which the crow wants to overflow}
Output Specification: Minimum number of stones required to make K pots overflow in worst case. Or -1 if input is invalid
Example: Let say there are two pots pot 1 has 0 value of 5 , 01= 5 pot 2 has 0 value of 58, 02= 58 Let say crow wants to make one of the pot to overflow. If he know which pot has what 0-value he would simple search for 5 stones and put then in pot 1 to make it overflow. But in real case he doesn't know which pot has what 0-value so just 5 stones may not always work. However he does know that one pot has 0-value S and other has 58. So even in worst case he can make one of the pot overflow just by using 10 stones. He would put 5 stones in one pot if it doesn't overflow he would try the remaining 5 in the other pot which would definitely overflow because one of the pot has 0-value of 5. So the answer for above question is minimum 10 stones even in worst case. Input : Input 1= {5,58} Input 2= 2 Input 3= 1 Output : 10| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersRahul is playing a very interesting game. He has some N different type of match boxes. All match boxes may have different number of matchsticks (S1, S2, S3... Sn).
- veeru in India
Rahul chooses two random numbers F and K. K should be less than N. The game is that Rahul wants to select any K match boxes out of N match boxes such that total number of matchsticks in these K selected match boxes should be multiple of F.
At the sametime Rahul wants that sum matchsticks of all the selected match boxes should be minimum possible.
Input Specifications:
1) Array S = {S1,S2,S3,...Sn} of size N corresponding to the number of match sticks in N matchboxes(0<=N<=1000}
2) F-Value (as explained above)
3) K-Value ( as explained above)
Output:
1 2 3 4 5 Here 3 is the number of matchsticks in matchbox I II III IV V minimum possible total number of matchsticks such that the conditioned explained in the problem statement is satisfied. Output -1 if it is not possible or invalid input.
For example, there are 5 match boxes i.e., N = 5
Let's say K is 3 (Rahul has to choose any 3 matchboxes)
Let's say F is 5(sum of matchsticks in 3 selected matchboxes should be multiple of 5).
Rahul can choose II, III and V matchboxes which would give the total sum of 10 which is multiple of F i.e., 5. And 10 is the minimum possible matchsticks possible in the above case.
So you have to answer the minimum possible matchstick(sum of the matchsticks in the selcted matchboxes) but the conditions given above should be satisfied.| Report Duplicate | Flag | PURGE
Algorithm - 1of 1 vote
AnswersWrite a class DominoChecker that has a method called addBox(int[]) that takes a box of five dominoes, described as a list of 10 integers (explained after), adds it to a collection, and returns true if a box with the same dominoes was already in the collection and false otherwise. A box of dominoes is encoded as a list of 10 integers from 0 to 9, where a pair of numbers represent a domino. For example: 0,2,9,1,3,3,7,4,5,6 represents a box containing dominoes: (0,2); (9,1); (3,3); (7,4); (5,6). http://en.wikipedia.org/wiki/Dominoes for more basic info (like pictures)
- veeru in United States| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer - 0of 0 votes
Answers
- veeru in IndiaFind the subsequences whose elements should not be adjacent and their sum should be maximum from the given array (contains only positive integers). Eg: int[] A = {10, 1, 3, 25} Sol: Sum: {10, 3} = 13 {1,25} = 26 {10,25} = 35 Here the Maximum subsequence is {10, 25}.
| Report Duplicate | Flag | PURGE
Myntra Software Engineer / Developer Arrays - 0of 0 votes
AnswersGiven an array of integers. Print a pair whose sum is closest to zero?
- veeru in India for Kindle Device
Eg:
Input: arr = {2 5 8 -7 2,9}
Output: => 8, -7| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays
I have done the code almost as below. I just explained about the overriding the hashcode method but not coded. Don't know what will be the result :-(
Could any one explain how to override the hashcode & compare the contents of Box object in Java?
class Domino {
int num1;
int num2;
}
class Box {
Domino[] dominos;
public Box(Domino[] dominos) {
this.dominos = dominos;
}
}
Hashtable<Box, Boolean> htable = new Hashtable<Box,Boolean>();
addBox(int[] box) {
Domino[] domino = new Domino[box.length()/2];
int domino_index = 0;
for(int i=0; i < 10; i=i+2) {
domino[domino_index] = new Domino();
domino[domino_index].num1 = box[i];
domino[domino_index].num2=box[i+1];
domino_index++;
}
Box boxobj = new Box(domino);
if(!htable.contains(boxobj) {
htable.add(boxobj)
return true;
}
else {
return false;
}
}
RepPacheTanley, Associate at Adobe
Hi , I am Conference service coordinator for the KB Toys company. I Build and maintain relationships with meeting planners and ...
Repjoyjerraj, Android test engineer at ASAPInfosystemsPvtLtd
I am a sales manager .I'm responsible for leading and coaching a team of salespeople. A sales manager's ...
RepNancy Nash, Area Sales Manager at Absolute Softech Ltd
Prior to my current job I was training soap scum in Africa. Earned praised for my work developing wooden trains ...
RepJohnMThomaa, Systems Design Engineer at USAA
Managed a small team writing about dust in Minneapolis, MN. Spent high school summers marketing Online vacuum pump sale New ...
RepWhyable is an agile team of Software Specialists with vast experience across multiple languages.We will help you to define ...
RepI am Jenae Wilder and I work as a content writer, A writer at day, and a reader at night ...
Repemileyrollens, Architect at Cloudera
I am Emily, a detail-oriented and certified junior Architect who excels at developing construction drawings, generating 3D models. I love ...
RepDo you need dua for controlling husband? Contact Guru ji right now. He provides the best and simple dua to ...
RepPal A Roos is the best early childhood & child development center in Charlotte. We are famous offering full-time, part-time and ...
Repruchikadolph, HR Executive at Accenture
I choose the talking books to match the book library clerk blind library patrons . I compare a list of borrowers ...
RepIsotherm is providing quality ceiling insulation and roofing insulation services to homes. We are one of the leading manufacturer company ...
RepMaryHDavis, Employee at ASU
Had a brief career promoting wooden tops in Salisbury, MD. My current pet project is lecturing about human hair in ...
RepHad moderate success buying and selling weebles in Ohio. Had some great experience buying and selling wooden trains on Wall ...
RepLove is the spice of everyone’s life. Love adds charm and excitement to the monotonous and boring life. If ...
Replovevashikaranmantrasolution, Data Engineer at ASAPInfosystemsPvtLtd
Are you searching the mantra for your lost love boyfriend? BabaJi will guide you with simple and effective mantra to ...
RepWant to know how to protect from black magic? Guru Ji is the world’s famous astrologer and he has ...
RepAre you looking for strong dua for husband love?Astrology is the perfect way to get your lost love back ...
RepAmber Van is registered and fully insured cheap removal company in Bristol.Our featured services includes domestic moves,commercial moves ...
Repmonicahbess, SDET at Adap.tv
Hi Everyone, I'm Monica H. Bess. I love to build props...everything from a casket to pneumatic monsters.My ...
RepIsotherm provides the best roof insulation products in Cape Town, South Africa. We offer insulation products for roofs, water pipes ...
Repkarmacknha, Accountant at Groupon
I am a forensic nurse . who has received specific education and training. I provide specialized care for patients who are ...
RepBlack magic removal mantra is the best remedy for you. Magic master provides 100% guaranteed solution.This power gives you ...
RepAre you searching for the most powerful and very strong mantra for your husband? If you want to do Jadoo ...
RepJonathan Galgano, Data Engineer at Blue Jeans
Drive with the most affordable Exotic Car Rental South Beach. Prestige luxury Rentals is offering you with the finest car ...
RepStevenBLuis, Data Scientist at Achieve Internet
Choose the best quality vaping accessories at Ny Vape Shop. With different types of quality vaporizers, we are one of ...
RepHazelMiller, Site Reliability Engineer at Delve Networks
Hazel Miller has been a stalwart advocate for sound public policy that advances the jobs creating potential of America’s ...
RepViviana Grave, Backend Developer at Achieve Internet
Working as a typically an electro-mechanical technician or technologist who ensures that medical equipment is well-maintained, properly configured, and safely ...
RepJohn Colcomb, Analyst at A9
With more than 20 years of car rental and dealership experience, responsible for developing growth strategies to maximize operational effectiveness ...
RepRocioNavarro189, None at Student
Hello Everyone,My name is Rocio Navarro Form Auckland,NZ,and 31 years old.I am searching for a servant ...
RepLarry Alvarez, Analyst at ASU
Prestige Luxury Rentals is one of the most renowned car rental companies in USA. We are locally owned and operated ...
RepSherryellis555, Computer Scientist at ASAPInfosystemsPvtLtd
My name is Sherri Ellie Once had a fantasy of testing the market for tar in Georgia, GE. Rehearsed in ...
RepSCREENish employee time tracking software can be used as desktop or mobile app. Once the employee has tracked his working ...
RepSergeykrestov156, System Administrator at Cerberus Capital
Hi everybody! I'm Sergey Kreston Hill New York and I'm an understudy of the Masters in Entrepreneurship and ...
RepHad a brief career donating velcro in Africa. Spent several years training sock monkeys in Pensacola, FL. Gifted in working ...
RepBlack magic mantra is simple and easy mantra. Call our specialist today for advice on black magic mantra to kill ...
RepIf you want to attract someone then astrologer kumar can help you. Astrologer kumar is specialized in offering kamdev vashikaran ...
RepHave some experience building shaving cream in Mexico. Prior to my current job I was marketing inflatable dolls in Jacksonville ...
RepAre you searching the strong and the most powerful Mantra for your husband? Consult our vashikaran specialist now. He provides ...
RepCrystalday777, Computer Scientist at AMD
My name is Crystal Day; I'm from Sydney, Australia, Get Ex Lost Love Back and I'm a sophomore ...
RepHave a strong interest in donating yogurt for the underprivileged. Spent several years building cabbage in Miami, FL. Spent several ...
RepHandyman Homes is the one-stop destination for all your home improvement and handyman needs.We take care of residential & commercial ...
Repastroamitji, Trust and Safety Engineer at Boeing
My name is (Canada Toronto). I'm in my last year in the CMOS program. I'm initially from Aminos ...
RepDaniel Wattss, Cloud Support Associate at A9
Spent 2001-2007 getting to know pogo sticks for no pay. Enthusiastic about researching deodorant in Los Angeles, CA. Prior to ...
Hi @Logan, It requires null check on prevProcess also bcz., if we want to add the Program like (8,1) then prevProcess will be null.
- veeru April 29, 2019