xyz
BAN USER- 0of 0 votes
AnswersTwo sum problem
- xyz in United States for Load Balancer| Report Duplicate | Flag | PURGE
Google Backend Developer - -1of 1 vote
AnswersHi there,
- xyz in United States
I'm using a Debian 8 system running Strongswan 5.2 to connect to Cloud VPN, but I'm seeing a large amount of packets being dropped. I'm not sure if the problem is on my side, so I need help debugging from the Google side.
11:44:15.127845 IP (tos 0x8, ttl 64, id 0, offset 0, flags [DF], proto ESP (50), length 1500)
204.154.94.43 > 104.198.99.16: ESP(spi=0x926a1ba9,seq=0x5fc78e8), length 1480
11:44:15.127846 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ESP (50), length 1500)
204.154.94.43 > 104.199.117.182: ESP(spi=0x2afc306c,seq=0x9753df), length 1480
11:44:15.127848 IP (tos 0x8, ttl 64, id 0, offset 0, flags [DF], proto ESP (50), length 1500)
204.154.94.43 > 104.199.124.50: ESP(spi=0x442d978a,seq=0xaae89d4), length 1480
Any ideas?
n3)Please explain briefly how you identified the correct solution, and if there were any other possibilities that you considered?| Report Duplicate | Flag | PURGE
Google Technical Support Engineer - 0of 0 votes
AnswersHi,
- xyz in United States
My virtual machine is talking to our on-premise Hadoop cluster and we have observed connections dropped by the VM after approximately 15 minutes after being established. We have tried tweaking our cluster and the VPN, but it did not work. We have also disabled any firewall or NAT: our cluster is connected directly to the Internet. We ran a TCP packet capture on one of our routers and we do see the following:
408 7.963058 178.124.133.65 172.16.72.34 TCP 66 http > 42867 [FIN, ACK] Seq=312 Ack=11 Win=14592 Len=0 TSval=3673141343 TSecr=234006479
409 7.963204 172.16.72.34 178.124.133.65 TCP 66 42867 > http [FIN, ACK] Seq=11 Ack=313 Win=15744 Len=0 TSval=234006482 TSecr=3673141343
410 7.995556 178.124.133.65 172.16.72.34 TCP 66 http > 42867 [ACK] Seq=313 Ack=12 Win=14592 Len=0 TSval=3673141351 TSecr=234006482
Please help, this is a fault in your network, I need a solution ASAP!
n1) If you were to troubleshoot / debug this issue, what areas would you look into to resolve the issue?
n2) Please explain briefly how you identified the correct solution, and if there were any other possibilities that you considered?| Report Duplicate | Flag | PURGE
Google Technical Support Engineer - 0of 0 votes
AnswersQuestion:
- xyz in United States
* Implement a program which receives tasks, which are basically objects with "run()" method and
* a long field, where long field indicates the time after which the task should start running
* by calling the run() method
EdgeCases:
* Imagine a case, where (A,10) task A is scheduled to run after 10 seconds
* and then when at 3rd second, another task B comes where (B,2) seconds
* then which one would be executed first ?| Report Duplicate | Flag | PURGE
Google Senior Software Development Engineer - 0of 0 votes
AnswersImplement a rate limiter attribute/decoration/annotation on top of an API endpoint. caps to N requests per minute with a rolling window (implement from scratch / test / compiling + working code. Was made to write the code in front of a computer.
- xyz in United States| Report Duplicate | Flag | PURGE
Google Senior Software Development Engineer - 1of 1 vote
AnswersGenerate a random number with UNIFORM DISTRIBUTION between [0,n) where n is given and excluded list is given. The randomly generated number should belong to the range [0, n) but should be excluded from the given excluded list. For example, n = 10 and excluded list ={2,3,0} then the random number should be from {1,4,5,6,7,8,9} such that any number from the list {1,4,5,6,7,8,9} has UNIFORM probablility of occuring
- xyz in United States for NEST| Report Duplicate | Flag | PURGE
Google Software Developer - 0of 0 votes
AnswersMake 100 HTTP GET requests to http://en.wikipedia.org/wiki/Main_Page and print the following in Java
- xyz in United States for Performance Optimization Team
statistics for the response time to stdout:
• 10th, 50th, 90th, 95th, 99th Percentile
• Mean
• Standard Deviation
Your solution must be parallel. You must make at least N (say 10, but should be configurable)
requests at a time.
Explain design choices, known limitations and edge cases.
What challenges did you face? How would you improve the code if you had more time?| Report Duplicate | Flag | PURGE
Google Senior Software Development Engineer - 0of 0 votes
AnswersThis is a two-part question.
- xyz in United States
Part one: Design one or more classes to represent the intersections and streets
in a city. Streets can be either one-way or two-way.
Part two: Using the classes from the previous question, determine whether there is a pair of intersections (A,B) such that there is exactly one route from A to B.| Report Duplicate | Flag | PURGE
Google Software Developer - 6of 6 votes
AnswersGiven an array such that every next element differs from the previous by +/- 1. (i.e. a[i+1] = a[i] +/-1 ) Find the local max OR min in O(1) time. The interviewer mentioned one more condition that the min or max should be non-edge elements of the array
- xyz in United States
Example: 1 2 3 4 5 4 3 2 1 -> Local max is 5
1 2 3 4 5 -> No local max or min exists
5 4 3 2 1 -> No local max or min exists| Report Duplicate | Flag | PURGE
Facebook Software Developer Algorithm
A small modification to the above program will give the result.
import java.util.HashSet;
import java.util.Set;
public class FindCelebrity {
static int knows[][];
public static void main(String[] args) {
knows = new int[][] {
{ 1, 0, 1, 1, 1 },
{ 1, 1, 1, 1, 1 },
{ 0, 0, 1, 1, 1 },
{ 0, 0, 0, 1, 1 },
{ 0, 0, 0, 1, 1 } };
Set<Integer> people = new HashSet<Integer>();
for (int i = 0; i < 5; i++) {
people.add(i);
}
System.out.println(findCelebrity(people));
}
public static int findCelebrity(Set<Integer> group) {
return isCelebrity(group, 0);
}
public static int isCelebrity(Set<Integer> group, int personInKRow) {
if (personInKRow >= group.size()) {
return -1;
}
// Everyone including celebrity knows themself.
// Hence even if knows[i][i] == 0 (i.e. a person who does not know himself)[which is an exception case]
// then also we should move forward
if (!knows(personInKRow, personInKRow)) {
return isCelebrity(group, personInKRow + 1);
}
for (int j = personInKRow + 1; j < group.size(); j++) {
if (knows(personInKRow, j)) {
// personInKRow is not the celebrity - knows some one else but
// himslef
// so check the person in line j
return isCelebrity(group, j);
} else {
// personInKRow does not know j then j is not the celebrity
}
}
return checkCandidate(personInKRow,group.size());
}
private static int checkCandidate(int candidate, int size) {
int count=0;
for(int i=0;i<size;i++){
if(i!=candidate && knows(i, candidate) && !knows(candidate,i)) // check if all rows are 0 and the columns are 1
count++;
}
if(count==(size-1))
return candidate;
else
return -1;
}
private static boolean knows(int i, int j) {
return (knows[i][j] == 1); // returns true or false
}
}
Something in Java, would have helped understand better
- xyz June 10, 2017