Forum Posts
2 Answers Looking for practice buddy
Hey everybody,
- Teddy C July 18, 2015
I'm preparing for my interviews at Google & Facebook and into practicing with others. I couldn't find any practice buddies because my friends are not looking for jobs at the moment.
So, I'm looking for practice buddies for Skype / Google Hangout mock interviews.
I'm usually available around the evening hours in the Pacific time zone. Hit up the comments if interested!| Flag | PURGE 1 Answer I am writing code in ruby and using each loop
@locations.each do |location|
- spraveen1112 June 15, 2015
if y_lower_bound > location.y_coordinate
y_lower_bound = location.y_coordinate
end
if x_lower_bound > location.x_coordinate
x_lower_bound = location.x_coordinate
end
end
I am trying the above code, but at the end of loop it give me syntax exception.| Flag | PURGE 0 Answers Removing even/odd numbers in problem 5.7 of cracking the coding interview
Following is problem 5.7 (under Bit Manipulation) in the 5th edition of Cracking the coding interview:
- shahsunny712 May 14, 2015
An array A[1..n] contains all the integers from 0 to n except for one number which is missing. In this problem, we cannot access an entire integer in A with a single opera-tion. The elements of A are represented in binary, and the only operation we can use to access them is “fetch the jth bit of A[i]”, which takes constant time. Write code to find the missing integer. Can you do it in O(n) time?
The algorithm applied is this:
1. Start with LSB.
2. Count occurrence of 1's vs 0's.
If count(1) < count(0) it means the missing number has a 1 as it's LSB, else it has a 0.
3. Remove all numbers with LSB not matching result found in step 3.
4. Repeat steps 1 to 4, and progressively checking the next LSB in each iteration.
Can someone explain the logic behind step 3? It basically removes all odd/even numbers from the current list (depending on the bit found for the missing number) and uses the modified list in the next iteration. Why do we do this?| Flag | PURGE 0 Answers Given a complete binary tree find if it is a value balanced tree or not.
A tree is called value balanced tree if for all nodes, sum of values (assume the values are integers) of nodes in left hand side is equal to sum of values in right hand side.
- JerryGoyal May 10, 2015
Given a complete binary tree find if it is a value balanced tree or not.
Test Case 1
3
1 1 1
Tree is value balanced
Test Case 2
7
3 0 -1 1 1 2 2
Tree is not value balanced
Test Case 3
15
22 2 4 -3 1 0 -4 4 4 2 2 2 2 4 4
Tree is value balanced
can it be done without creating tree data structure, solely from array?| Flag | PURGE 1 Answer Best resource to understand asymptotic analysis or time complexity.
I am having a hard time understanding the calculations for time complexity/asymptotic analysis. I tried referring possible algorithm books I could i.e. Cormen, Steven Skiena and few others. I just don't want to memorize the time complexity of every algorithm to clear the interviews, but wish to understand how to come up with the time complexity.
- ACE CA April 27, 2015
Please let me know what is the best way to learn and understand time complexity.| Flag | PURGE 0 Answers Looking for interview practices
I am applying a CS developer position at major IT companies. Although I have studied many available interview questions, I would like to have more in-person practices. If you are also working towards the same goal, we would help each other to practice more for better result. We can utilize a Skype or similar. Please let me know if you are interested. Usernamepi@outlook.com
- cs April 27, 2015
Thanks.| Flag | PURGE 0 Answers SQL
I have three tables as mentioned below. I need to implement a basic search functionality where user will search for a keyword which could either match 'title' (from Proposal table) or 'msNumber' or 'description' (from Project table) and should match 'stageNumber' and 'newState' from ProjectLifecycle table.
- ravicandy1234 April 27, 2015
create table Proposal (
proposalId LONG not null primary key,
title VARCHAR(75) null,
);
create table Project (
proposalId LONG not null primary key,
msNumber VARCHAR(75) null,
description VARCHAR(75) null
);
create table ProjectLifecycle (
lifecycleId LONG not null primary key,
proposalId LONG,
stageNumber DOUBLE,
newState LONG,
);
Below is the query which am using right now
SELECT
p.proposalId, p.title, pj.msNumber
FROM
Proposal p
JOIN
ProjectLifecycle pl ON pl.proposalId = p.proposalId
JOIN
Project pj ON pj.proposalId = pl.proposalId
WHERE
(p.title like '%%' or pj.msNumber like '%%')
AND
pl.newState=0
AND
(pl.stageNumber= 60.60 OR pl.stageNumber < 60.60 OR pl.stageNumber = 95.99);
The stageNumber and the newState conditions are working fine as expected but the keyword search isn't.
Please help me in finding where i'm going wrong| Flag | PURGE 0 Answers trip planner problem
The input is the set of flights between various cities. It is given as a file. Each line of the file contains "city1 city2 departure-time arrival-time flight-no. price" This means that there is a flight called "flight-no" (which is a string of the form XY012) from city1 to city2 which leaves city1 at time "departure-time" and arrives city2 at time "arrival-time". Further the price of this flight is "price" which is a poitive integer. All times are given as a string of 4 digits in the 24hr format e.g. 1135, 0245, 2210. Assume that all city names are integers between 1 and a number N (where N is the total number of cities).
- ry197089 April 23, 2015
Note that there could be multiple flights between two cities (at different times).
The query that you have to answer is: given two cities "A" and "B", times "t1", "t2", where t1 < t2, find the cheapest trip which leaves city "A" after time "t1" and arrives at city "B" before time "t2". A trip is a sequence of flights which starts at A after time t1 and ends at B before time t2. Further, the departure time from any transit (intermediate) city C is at least 30 mins after the arrival at C
what approach will be best for solving this| Flag | PURGE 0 Answers Hello All
I am planning to shift my Job in India (In companies like linkedIn, FlipKart, Snapdeal ,Amazon,WalMart , Microsoft.
- vishraji81 April 10, 2015
I am 12 years experience in C++ Algorithms and DataStructures . I am average in Algos. The time period I have thought I should give the interviews by next month So Can some one tell me the best strategy to prepare for the job change .| Flag | PURGE 0 Answers effective parallelisation bilinear interpolation using OpenMP
I want to parallelise bilinear interpolation using OpenMP in such a way that there should be least memory access of input array. In the code below, for each iteration of i and j in output array, input data according to longitude and latitude values are read and processed.
- pritish.naik.004 April 10, 2015
input[20][20] - input array that contains data values eg{1,2,3,..,400} in 2d
lon[100][100] - longitudinal positions of each interpolation point in output array in horizontal axis not necessarily equidistant. eg. {2.34,2.65,2.74... }
lat[100][100] - latitudinal positions of each interpolation point in output array in vertical axis not necessarily equidistant.eg. {5.76,5.92,6.26... }
output[100][100] - array containing interpolated values
void interpolate(float (*lon)[100] ,float (*lat)[100] , float (*input)[100],float (*output)[100]) {
int i,j,floori,floorj;
float fractionj,fractioni;
for(j = 0; j < 100; j++)
{
for(i = 0; i < 100; i++)
{
floori = lon[i][j];
fractioni = lon[i][j] - floori;
floorj = lat[i][j];
fractionj = lat[i][j] - floorj;
output[i][j] = (1.0-fractioni)*(1.0-fractionj)*input[floori][floorj] + fractioni*(1.0-fractionj)*input[floori+1][floorj] + (1.0-fractioni)*fractionj*input[floori][floorj+1] + fractioni * fractionj *input[floori+1][floorj+1];
}
}
}
I need to divide the work in such a way that for all the interpolation points specified using lon and lat values within block of input[floori][floorj],input[floori+1][floorj],input[floori][floorj+1],input[floori+1][floorj+1] should go to one thread so that input values are read only once from memory to register for each thread.| Flag | PURGE 0 Answers Amazon Onsite Interview Result
Hi
- conundrum4u April 09, 2015
I have had an Onsite interview at Amazon on March 17th(which i think went well from myside). Still didn't hear anything back from them. I have put a mail on Monday but didnt hear back from them.
1.Can you please let me know if anyone who went around the same date, heard anything back?
2. What does this delay usually mean? Is it a Red flag:(
3. Do they usually sent rejection mails or do they not?
Please let me know!
Thanks in advance!| Flag | PURGE