## 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 - 0 Answers
**Check if graph is connected**Hi all I want to my method to return true if two node of un directed graph is connected,

- apurohit.in May 09, 2015

Method print yes its connected but return false ?

public static boolean isConnectedGraph(int[][] graph, int start, int end,

int visited[]) {

visited[start] = 1;

if (graph[start][end] == 1) {

System.out.println("yes its connected ....");

return true;

}

for (int i = 0; i < graph[0].length; i++) {

if (graph[start][i] == 1 && visited[i] == 0) {

visited[i] =1;

isConnectedGraph(graph, i, end, visited);

}

}

return false;

}| 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

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window