Forum Posts
- 0 Answers Who is our boss
Initech is a company which has CEO Bill and a hierarchy of employees. Employees can have a list of other employees reporting to them, which can themselves have reports, and so on. An employee with at least one report is called a manager.
- gundam0083ster February 02, 2014
Please implement the closestCommonManager method to find the closest manager (i.e. farthest from the CEO) to two employees. You may assume that all employees eventually report up to the CEO.
Bill
CEO
|
-----------------------
| | |
DOM SAMIR MICHAEL
|
-------------------
| | |
BOB PETER PORTER
|
-----
| |
MILTON NINA
Sample Data: CEO Bill has 3 employees reporting to him: {Dom, Samir, Michael} Dom has three reports { Peter, Bob, Porter} Samir has no reports {} Michael has no reports {} Peter has 2 reports {Milton, Nina} Bob has no reports {} Porter has no reports {} Milton has no reports {} Nina has no reports {}
Sample calls: closestCommonManager(Milton, Nina) = Peter closestCommonManager(Nina, Porter) = Dom closestCommonManager(Nina, Samir) = Bill closestCommonManager(Peter, Nina) = Peter| Flag | PURGE - 0 Answers Who is our boss
Initech is a company which has CEO Bill and a hierarchy of employees. Employees can have a list of other employees reporting to them, which can themselves have reports, and so on. An employee with at least one report is called a manager.
- gundam0083ster February 02, 2014
Please implement the closestCommonManager method to find the closest manager (i.e. farthest from the CEO) to two employees. You may assume that all employees eventually report up to the CEO.
Bill
CEO
|
-----------------------
| | |
DOM SAMIR MICHAEL
|
-------------------
| | |
BOB PETER PORTER
|
-----
| |
MILTON NINA
Sample Data: CEO Bill has 3 employees reporting to him: {Dom, Samir, Michael} Dom has three reports { Peter, Bob, Porter} Samir has no reports {} Michael has no reports {} Peter has 2 reports {Milton, Nina} Bob has no reports {} Porter has no reports {} Milton has no reports {} Nina has no reports {}
Sample calls: closestCommonManager(Milton, Nina) = Peter closestCommonManager(Nina, Porter) = Dom closestCommonManager(Nina, Samir) = Bill closestCommonManager(Peter, Nina) = Peter| Flag | PURGE - 2 Answers Who is our boss
Initech is a company which has CEO Bill and a hierarchy of employees. Employees can have a list of other employees reporting to them, which can themselves have reports, and so on. An employee with at least one report is called a manager.
- gundam0083ster February 02, 2014
Please implement the closestCommonManager method to find the closest manager (i.e. farthest from the CEO) to two employees. You may assume that all employees eventually report up to the CEO.
Bill
CEO
|
-----------------------
| | |
DOM SAMIR MICHAEL
|
-------------------
| | |
BOB PETER PORTER
|
-----
| |
MILTON NINA
Sample Data: CEO Bill has 3 employees reporting to him: {Dom, Samir, Michael} Dom has three reports { Peter, Bob, Porter} Samir has no reports {} Michael has no reports {} Peter has 2 reports {Milton, Nina} Bob has no reports {} Porter has no reports {} Milton has no reports {} Nina has no reports {}
Sample calls: closestCommonManager(Milton, Nina) = Peter closestCommonManager(Nina, Porter) = Dom closestCommonManager(Nina, Samir) = Bill closestCommonManager(Peter, Nina) = Peter| Flag | PURGE - 0 Answers Who is our boss
Initech is a company which has CEO Bill and a hierarchy of employees. Employees can have a list of other employees reporting to them, which can themselves have reports, and so on. An employee with at least one report is called a manager.
- gundam0083ster February 02, 2014
Please implement the closestCommonManager method to find the closest manager (i.e. farthest from the CEO) to two employees. You may assume that all employees eventually report up to the CEO.
Bill
CEO
|
-----------------------
| | |
DOM SAMIR MICHAEL
|
-------------------
| | |
BOB PETER PORTER
|
-----
| |
MILTON NINA
Sample Data: CEO Bill has 3 employees reporting to him: {Dom, Samir, Michael} Dom has three reports { Peter, Bob, Porter} Samir has no reports {} Michael has no reports {} Peter has 2 reports {Milton, Nina} Bob has no reports {} Porter has no reports {} Milton has no reports {} Nina has no reports {}
Sample calls: closestCommonManager(Milton, Nina) = Peter closestCommonManager(Nina, Porter) = Dom closestCommonManager(Nina, Samir) = Bill closestCommonManager(Peter, Nina) = Peter| Flag | PURGE - 0 Answers Compiler Design
0
- rohit January 28, 2014
down vote
favorite
Creating email addresses form names
You have given a file containing names of several persons. The file will have exactly one name is each line. You need to create email address ending with @bitmesra.ac.in from those names. the rule for creating email address is defined below: A name will be expressed in the following form: ............
Let F(s) denote the first character of string s. so, email id will be F(string 1)F(string 2)........._lastString@bitmesra.ac.in Some names and their corresponding email id's are listed below as an example
Sachin Ramesh Tendulkar s_r_tendulkar@bitmesra.ac.in Rahul S Dravid r_s_dravid@bitmesra.ac.in
You need to generate a grammer for this.
note: there may multiple spaces b/w names.
my code is here...
#include<cstdio>
#include<cstring>
#include<cctype>
int main()
{
char str1[100],str2[100];
char str3[] = "@bitmesra.ac.in";
while(gets(str1))
{
int index,k=0;
str2[k] = tolower(str1[0]);
for(int i=1;i<strlen(str1);i++)
{
if(str1[i]==' ')
{
index = i;
if(isalpha(str1[i+1]))
{
k++;
str2[k] = '_';
k++;
str2[k] = tolower(str1[i+1]);
}
}
}
index= index + 2;
for(int i=index;str1[i]!='\0';i++)
{
k++;
str2[k] = tolower(str1[i]);
}
str2[++k] = '\0';
strcat(str2,str3);
printf("%s\n",str2);
}
return 0;
}
how to desing CFG for this...| Flag | PURGE - 2 Answers Intel Telephone Interview
Hi everyone. I might have a Intel telephonic interview for a web software intern next week. What kind of questions can i expect other than web related questions(like C#, ruby)? Any information is valuable and appreciated. Thanks
- viswanth.chadalawada January 24, 2014| Flag | PURGE - 0 Answers Google Interview Questions - Engineering Practicum
Hello. I have my interviews with Google very soon. I was wondering if anyone would have an idea of what the questions were like for the engineering practicum. I know there is a list of questions on here, but those seem kinda difficult. I am only a freshman in college and my recruiter told me they are gearing this program towards 1st and 2nd years. What should I expect? The only requirement to apply is CS 1.
- chrismallon23 January 22, 2014| Flag | PURGE - 1 Answer I need to get private coding lessons urgently!
Hi,
- surena1256 January 19, 2014
I will have a technical interview on 29th of January and I need your help on preparing to this interview. It would be great if you can give private lessons to me so that I can prepare better in limited time. We can negotiate on per hour rate + bonus if I get the job.
There are more than 3000 algorithm questions on topcoder.com so I need you to prioritize some of those questions and explain the problems and solutions so that I can learn solutions of more questions in limited time.
I want to study with 3 people (3hours/day with each of the selected candidates for 10 days)
We can work on skype. If you're interested on helping me, please send
-your skype id
-topcoder id
-an hourly rate+bonus proposal
-day and time to make first skype meeting
to surena1256@gmail.com
Thank you for your help in advance!| Flag | PURGE - 0 Answers NZEC error java..please help
import java.io.BufferedReader;
- guptaabhinav206 January 17, 2014
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Vector;
import java.math.BigInteger;
public class Mkequal
{
public static void main(String[] args)throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
Scanner sc=new Scanner(System.in);
int t=Integer.parseInt(br.readLine());
while(t-->0)
{
int sum=0;
int n=Integer.parseInt(br.readLine());
int arr[]=new int[n];
for(int i=0;i<n;i++)
arr[i]=sc.nextInt();
for(int i=0;i<n;i++)
sum+=arr[i];
if(sum%n==0)
System.out.println(n);
else System.out.println(n-1);
}
}
}| Flag | PURGE - 1 Answer Where to start?
Hello, I am looking to change the job and not sure from where should I start? I am presently working as a software developer and am looking forward for a challenging job in some big organizations in US itself. Right now I am kind of off with the basics as I am not using it on daily basis for my present job. I have already been through 2 interviews, one with Google and other with Amazon and both were coding interviews dealing with time complexities as well and I did worst in both of them in terms of choosing a correct way to solve the problem. Few people suggested me to start reading 'Cracking the Coding interview' and similar books but I am still confused as to whether should I directly start with those books or read and clear my basics first since its too long I have been through them? Could someone please help suggest me a good plan to start with?
- ACE CA January 13, 2014| Flag | PURGE - 2 Answers question
Stakeout
- mike@unitedrmr.com January 12, 2014
Congratulations! You are the new elite hacker in a group of villainous ne'er-do-wells.
Luckily this group is more saavy than your last band of ruffians, and they are looking to software (and you) to improve their take. The con man for the team, has gone door-to-door down each street posing as a termite inspector so he could covertly total the valuable goods in each house. Normally the gang would just rob all the valuable homes, but there's a catch! Whenever a house is robbed in this wealthy neighborhood, the police watch it and the neighboring houses for months.
So the gang can't simply rob all the homes, and if they choose to rob one, they can no longer rob the house on either side of it.
The ringleader wants to know what houses he should rob to maximize the team's profit, and he wants to know now. Write a function that takes in an array of positive integers (home values) and returns the maximum expected value of robbing that street.
For example:
[ 20, 10, 50, 5, 1 ] should return $71, as robbing the first, third, and fifth houses is optimal [ 20, x, 50, x, 1 ]
[ 20, 50, 10, 1, 5 ] should return $55, as robbing the second and fifth houses is optimal [ x, 50, x, x, 5 ]
special case
[20, 50, 50, 1,5] should return 75 and not 56
Best Regards
Mike| Flag | PURGE - 0 Answers question
Stakeout
- mike@unitedrmr.com January 12, 2014
Congratulations! You are the new elite hacker in a group of villainous ne'er-do-wells.
Luckily this group is more saavy than your last band of ruffians, and they are looking to software (and you) to improve their take. The con man for the team, has gone door-to-door down each street posing as a termite inspector so he could covertly total the valuable goods in each house. Normally the gang would just rob all the valuable homes, but there's a catch! Whenever a house is robbed in this wealthy neighborhood, the police watch it and the neighboring houses for months.
So the gang can't simply rob all the homes, and if they choose to rob one, they can no longer rob the house on either side of it.
The ringleader wants to know what houses he should rob to maximize the team's profit, and he wants to know now. Write a function that takes in an array of positive integers (home values) and returns the maximum expected value of robbing that street.
For example:
[ 20, 10, 50, 5, 1 ] should return $71, as robbing the first, third, and fifth houses is optimal [ 20, x, 50, x, 1 ]
[ 20, 50, 10, 1, 5 ] should return $55, as robbing the second and fifth houses is optimal [ x, 50, x, x, 5 ]
special case
[20, 50, 50, 1,5] should return 75 and not 56
best regRDS MIKE| Flag | PURGE - 0 Answers Saas - Assignment 14 Wordy En...
Saas - Assignment 14
- ramit.kss January 10, 2014
Wordy Enough
A student, doing his apprenticeship as a linguist, is given a rather boring problem. His mentor has given him a list of words and a long string of characters. All the characters in the list of words and the long string of characters are in capital. The student has to look at the characters and decide how many words from the given list can be formed using the long string of characters. However, there are some rules of counting:
• Each character in the word must be accounted for in the character stream, i.e. if a character appears twice in a word, then it must also appear twice in the stream. For example, the word 'NEED' can only be formed if 'E' occurs twice in the long character string.
• Once a character is used up for a word, it cannot be used again for forming other words.
The student has to form the maximum number of words possible. You have to write a program to do this and help him to concentrate on other more interesting problems.
Input specification:
• The first line of input contains an integer 'w', which denotes the number of words in the list.
• The second line of input consists of 'w' words, each separated by a white space. The length of each word will never exceed 20 characters.
• The third line of input contains an integer 's' which denotes the number of characters in the long string of characters.
• The fourth line of input, which is a long character string, consists of 's' characters.
Output specification:
Your program has to output an integer 'm', denoting the maximum number of words possible.
Sample Input and Output:
Input:
9
SATAN SEES OASIS STRAIGHT FORWARD SENSE FROG DREW SHIRTS
20
A A E E I O D F G H N R R R S S S T T W
Output:
4| Flag | PURGE - 1 Answer How Timer calls a callback function in C
I would like to implement a scheduler.
- Remo January 05, 2014
The scheduler would be assigned multiple jobs and will configure the time interval when the job/callback function should called...
I could say, Callback-function_1 should be called after 20 secs and callback-function_2 should be called after 30 secs like that....
we can assume, from the start time, after 20 secs the first callback-function would be called...
How all these callback functions are put into a queue (the one which is going to be called soon has to be first...) and how they have been called ? How the timer invokes those callback-functions ? How do we pass an arguments to the callback-functions in this case...?| Flag | PURGE - 6 Answers How to start preparation
Hi I am Mukul Budania.
- mukul.master2008 January 01, 2014
I am in Oracle for almost 3.5 years.
2 years I was into Server testing and then I moved into Development. My work mostly relates to Rest Api development and I am working in Oracle Cloud Project.
I am looking forward to move to some other company.
Which all companies I should Apply.
How should I start preparation - Algorithm, Data Structures, Design Patterns??| Flag | PURGE