Forum Posts
0 Answers Given 5 horses or runners and 10 sensors return top runners
Basically you have 5 horses running. There are 10 sensors spread out over the race. You want the ability to ask what are the 5 fastest horses in order and do so in the fastest way. How would you construct the data structures in order to return the top fastest running horses? Should minimize overhead and be as fast as possible to return the top in order. Any ideas? Thanks.
- eriklukeyale March 24, 2015| Flag | PURGE 0 Answers Given an integer of a certain bit length, does it have an even or odd number of parity bits?
The code is
- chandram.CM26 March 23, 2015
public static Integer evenParity(Integer number){
return (number == 0) ? 0 : ((number&1) + evenParity(number>>1))%2;
}
I am a newbe, I have a basic question here. We need to count the number of ones and if they are odd, then its odd or even parity bit. Now, when we look at the code, the code keeps right shifting the number until it reaches '0'. So, we are counting bits from different number than the one passed.My, understanding was we should count the one bits of a given number without chaining the number. Even though this code is working correctly I'm not able to understand how this is working.
Thanks| Flag | PURGE 0 Answers Scalability and memory limits chapter example problem
Hi Everyone,
- experiments.with.fb March 22, 2015
I'm having some trouble understanding what is on page 113 - if the list of words that is being searched among the documents keeps changing, what is the point of the preprocessing that has been explained. Before I looked at their method, I came up with my own "sunny day" solution where we assume there are just a few documents and everything is on one computer. My mappings were from document to list of words, for example, if our list of words is {red, blue, green, yellow}; at the end of my solution the mapping would look something like
doc1 - red, blue
doc2 - red, green
doc3 - green, blue, yellow
and the result would be all of the docs in the mapping - doc1, doc2, doc3.
Those docs that did not contain any of the words in the list, do not occur in the mapping at all.
I guess a valid question for the interviewer is "what is the input to findWords?" OR "is the list of words constantly changing?" To me the obvious answer is yes it is changing. But I am just posting this incase I misunderstood the problem.
Can someone help me understand, what is the use in preprocessing the way it is explained on page 113, when the list of words is constantly changing?
Thanks so much!| Flag | PURGE 0 Answers Looking for Milwaukee interview and coding question buddy
Hi all!
- litehsu March 20, 2015
I am currently preparing for interviews and would like to meet up with some one to practice coding and mock interviews in Milwaukee area!
You can reach me at my email litehsu@gmail
thanks!| Flag | PURGE 2 Answers Looking for a study buddy in Portland, OR area
I have a technical phone interview for Google on the 6th of April and I want to make sure I am prepared.
- hbourke@pdx.edu March 20, 2015
I'm a recent grad (really, really recent, I literally graduated today, a couple of hours ago).
I need to study quite a bit so I feel comfortable, because I tend to be a nervous interviewee.
The thing is, I'm so used to studying in groups in college. I don't like studying by myself! It feels lonely, plus I am more focused when I am working together with someone.
If you are also studying for an interview in the Portland area, maybe we can meet at the PSU or downtown library or a coffee shop and work.
P.S.,
I'm really looking to *get things done*. So while breaks are necessary and occasional chit-chat is fine, the objective is not to meet people. The perfect study buddy would be someone who is also motivated.| Flag | PURGE 0 Answers Using Disjoint Data Structures
Downtown Gotham is booming and the main road is now lined with a continuous row of skyscrapers. For aesthetic reasons, the Gotham Development Council had banned advertising hoardings along the main road.
- f2010190@pilani.bits-pilani.ac.in March 17, 2015
The High Court has squashed the Council's ban as unconstitutional and ruled that rectangular hoardings may be put up parallel to the main road, along the walls of the skyscrapers lining the road. The only restriction is that a hoarding may not extend above the height of any building along its length. Advertising agencies across the city are buzzing with excitement at the news and accounts executives are busy calculating how large they can make their hoardings, in terms of total area, to collect maximum revenue from advertisers.
Suppose the skyline is represented as follows, where each skyscaper is represented by its height and width, both quantities measured in metres. The first line of input is an integer N, the number of skyscrapers. This is followed by N lines of input describing the skyscrapers in left to right order. Each of these lines consists of two integers W and H, specifying the width and height of the skyscraper, respectively. The task is to compute the maximum area that a hoarding can have for a given arrangement of skyscrapers.
8
20 30
10 50
30 70
20 50
10 10
20 55
30 80
20 40
It is my first program in C++, in Union-Find and using vectors(yeah too ambitious for the first problem). I wanted to know if the flow of the program is atleast partially correct. Besides, I am getting the error: “glibc detected” along with a wrong answer. So, should I start afresh or am I almost there?
#include <iostream>
#include <algorithm>
#include <vector>
#define N_MAX 100000
using namespace std;
vector<int> parent;
vector<int> rank;
//vector<int> length;
vector<int> ht;
vector<int> wt;
class skyscraper
{
public:
int height;
int width;
};
struct sortH
{
int i,height;
bool operator<(const sortH& p)const
{
return (height > p.height);
}
};
void make_set(int x,int height,int width)
{
parent[x] = x;
rank[x] = 0;
//length[x] = 1;
ht[x] = height;
wt[x] = width;
}
int find(int x)
{
if(parent[x] != x)
{
parent[x] = find(parent[x]);
}
return parent[x];
}
void set_union(int x,int y)
{
int root_x,root_y;
root_x = find(x);
root_y = find(y);
if(rank[root_x] < rank[root_y])
{
parent[root_x] = root_y;
}
else
{
parent[root_y] = root_x;
rank[root_x] += (rank[root_x] == rank[root_y]);
}
}
int main()
{
int N,i,j,k,l,x,y,z;
int H;
int W;
int Amax,LA,RA,A,S;
cin >> N;
//Union of children
parent.resize(N);
rank.resize(N);
ht.resize(N);
wt.resize(N);
////////////////////////
sortH p[N];
vector<skyscraper> skyline(N);
for(i = 0; i < N; i++)
{
cin >> skyline[i].width;
cin >> skyline[i].height;
p[i].height = skyline[i].height;
p[i].i = i;
make_set(i,skyline[i].height,skyline[i].width);
}
sort(p,p+N);
H = p[0].height;
W = skyline[p[0].i].width;
Amax = H * W;
for(i = 1; i < N; i++)
{
j = p[i].i;
k = j-1;
l = j+1;
S = skyline[j].height * skyline[j].width;
x = skyline[j].height;
y = skyline[k].height;
z = skyline[l].height;
if(x < y)
{
set_union(k,j);
ht[k] = x;
wt[k]+= skyline[k].width;
LA = ht[k] * wt[k];
}
if(x < z)
{
set_union(l,j);
ht[l] = x;
wt[l] += skyline[l].width;
RA = ht[l] * wt[l];
}
if(S < LA) S = LA;
if(S < RA) S = RA;
if(Amax < S) Amax = S;
}
// if(skyline[j].height
// }
// for(int i = 0; i < N; i++)
// {
// cout << skyline[i].height << ' ' << skyline[i].width << endl;
// }
// for(int i = 0; i < N; i++)
// {
cout << Amax << endl;
// }
}| Flag | PURGE 1 Answer Amazon. been two days no phone interview confirmation email
I got an email from Amazon on Friday night that I completed the first assessment and they will set up one phone interview. They asked me about the best times for me and phone number to call on. Today I still have not received any email message yet with the confirmation of when the interview is.
- moezein92 March 10, 2015
Any thoughts ? How long did it take them to confirm the times for the phone interview with you?| Flag | PURGE 5 Answers Anxiety during technical phone or in-person interview???
I have a major problem, where I cannot perform anywhere close to my actual ability when I am asked to code something non-trivial during a phone or in-person interview.
- tjcbs2 March 05, 2015
At work, I *hate it* when someone is watching me as I code. I hate the idea of someone observing my thought process, and watching my mistakes. It is anxiety provoking, and I either start screwing up or make them go away. And this is typically with some random guy, who is probably bored and doesn't care, with code that is probably trivial, and in sum the interaction is completely meaningless.
During an interview, the problem is 100x worse. Here, it is almost always a non-trivial problem, with someone who is very much so evaluating what I do, and how long it takes me to do it, in an interaction which may have a significant effect on the course of my life. It is excruciating, and I will often go silent, with my head horrifyingly blank, and the interviewer will have to help me limp someplace vaguely close to the finish line.
It is maddening, that I would usually have no problem completing these problems on my own. And having to perform under that kind of pressure is so completely divorced from the actual reality of being a software engineer.
Can anyone else relate to this? Is there any hope for me, or am I simply excluded from companies with these kind of interviews.| Flag | PURGE 2 Answers Puzzle
8 people want to cross a river via boat only. They are mother , father, policeman, criminal, 2 daughters, 2 sons.
- mailtosumeet88 March 02, 2015
The boat can be driven by Police, mother or father only.
The boat carries only 2 people at a time.
The criminal if left without police can hurt someone but wont run away if he is alone.
The daughters left without mother would be hurt by the father.
The sons left without Father would be hurt by the mother.
If one a riverside mother is absent and father arrives by boat, he can still hurt the daughters and vice versa.
Find a way to take them all to the other side safely, without hurting anyone.| Flag | PURGE 0 Answers Finding first no repeated characters in string
How it is possible to use HashMap or HashTable to find out first non repeated character since both HashMap and HashTable does not guarantee that the order of the map will remain constant over time?
- Arunkumar V February 20, 2015| Flag | PURGE 7 Answers Google Online Assessment
I got one of those e-mails from the Google Blueprint Team asking me to take an online assessment.
- hbourke@pdx.edu February 18, 2015
I'm super nervous because the test is timed. Can someone give me some advice on not screwing it up by having a panic attack?
What I really need is a practice test. It's not important that the questions be super relevant or anything, I just need to go through the motions of taking the test before I actually take it so that my nerves don't get the best of me.
I'd also like to know if anyone knows if getting this e-mail means that I passed the initial screening. Does this mean that my resume was selected for this next step? Or is this an automated e-mail that everyone receives. If it does mean that my resume cleared the initial screening, was I likely screened by a human? Or do they simply have a script scanning for specific words. Similarly, will my code assessment be reviewed by a human? Or by a script?| Flag | PURGE 0 Answers What Programming Programming Language should a Computer Science Student must learn
During my college I studied C/C++, C#.Net and ASP.Net. Now one my friend suggested me to learn Python & MATLAB also. He wasn't much specific why. I've also seen lots of good resume, mostly they have Python (Scripting Language), MATLAB, plus above languages that I've studied. I've to appear for interviews in 3 months, So please guide me what should I do.
- Atinesh February 15, 2015| Flag | PURGE 2 Answers Handling the GPA question with a bad GPA.
So I graduated with a pretty terrible gpa (way closer to a 2.00 than a 3.00 and let's just leave it at that :[). I struggled early on and truthfully I came with pretty much zero relevant skills out of highschool. Most of my math is self taught, still I got the BS instead of the BA in CS. Did Calc1&2, Calc based physics 1&2. I can do the stuff, but I got Cs and Bs rather than As. And of course, some Ds and Fs sprinkled in.
- charstar February 10, 2015
Usually I try and spin it to something positive about overcoming struggle and having to be self taught with a lot of prior requirements for my courses, but I'm worried that this comes off as too defensive.
How would you handle it? I feel like the question comes up and my entire tone changes. I'd like to be able to portray how it means nothing to me and that I'm very confident in my skills, but I don't think it's coming off that way.
My in major GPA wasn't much better, but I finished strong. Even took some grad level courses and got As. I mention that, usually.
For the record, I did spend a lot of time post-graduation brushing up on some weak areas. I think I'm pretty well rounded right now. I tend to interview really well, so to me it really is a matter of making them see that it is no big deal.| Flag | PURGE 5 Answers expectation of companies hiring at 6 year experience and their salaries
Hi All,
- napster.ashish February 04, 2015
I am planning to join a product company after working many years in service company. Earlier I have prepared for Microsoft, Amazon, Expedia but that was like 3-4 years before.
My question is do these companies hire people at 6-7 years of experience level. Also what is their expectation from a candidate at this experience level. And what annual package am I looking at if I get a job offer at MS/Amazon/Expedia.
Regards,
Ashish| Flag | PURGE 1 Answer IEE float to IBM float conversion in java
IEEE float to IBM float value conversion
- gsuit123 February 03, 2015| Flag | PURGE
Open Chat in New Window