aifra2000
BAN USER
- 1of 1 vote
AnswersConvert a binary tree to a doubly linked circular linked list.(Tree is binary and not BST).Hint: using Inorder Traversal
- aifra2000 in United States for Multiple| Report Duplicate | Flag | PURGE
Facebook Software Engineer - 0of 0 votes
AnswerDesign and implement an algorithm to assign an unlimited M number of messages evenly among N number of servers (N will not change).
- aifra2000 in United States
Input to the algorithm
A message contains a message identifier and a text string. The algorithm will be fed one message at a time.
There are N numbers of servers (N will not change), each can be identified by a unique id.
Output of the algorithm
When the algorithm is called to process a message, it should output the id of the server that the message is assigned to.| Report Duplicate | Flag | PURGE
Facebook SDE-3 - 0of 0 votes
AnswersWrite code for the following: given a text file containing this information (Date the customer is logged in, tab, customer id)
- aifra2000 in United States for Amazon Alexa
04/11/2017 /t 0003
04/12/2017 /t 0003
04/13/2017 /t 0004
04/13/2017 /t 0003
How to get the list of those customers that log in on three consecutive days.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersOOPS: How to design Amazon locker? Provide code using OOP
- aifra2000 in United States for Amazon Alexa| Report Duplicate | Flag | PURGE
Amazon Software Engineer - -1of 1 vote
AnswersHow to merge two binary trees in place? (without creating a new node)
- aifra2000 in United States for Amazon Alexa| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 1of 1 vote
AnswersGiven a list of ranges as input ((1,2),(3,4),(3,6),(8,10)),the output would be those ranges that don't overlap.For example, the output could be merging the ranges 1) (1,2),(3,4)
- aifra2000 in United States
2) (1,2) (3,6) etc
The output cannot contain (3,4),(3,6) as 3 is common to both| Report Duplicate | Flag | PURGE
Amazon Java Developer Java
public static boolean findTriplet(int[] arr,int sum) {
int l,r;
//sum=9;
Arrays.sort(arr);//2,3,4,6
for(int i=0;i<arr.length-2;i++) {
l=i+1;
r=arr.length-1;
while(l<r) {
if(arr[i]+arr[l]+arr[r]==sum)
return true;
else if(arr[i]+arr[l]+arr[r] < sum)
l++;
else
r--;
}
}
return false;
}
public class MergeLists {
Node root;
Node root2;
class Node{
int data;
private Node next;
public Node(int data) {
this.data=data;
}
}
public void buildFirstList() {
root=new Node(1);
Node n1=new Node(2);
root.next=n1;
Node n2=new Node(3);
n1.next=n2;
Node n3=new Node(4);
n2.next=n3;
}
public void buildSecondList() {
root2=new Node(10);
Node n1=new Node(20);
root2.next=n1;
Node n2=new Node(30);
n1.next=n2;
Node n3=new Node(40);
n2.next=n3;
}
public void traverseAlt(Node n,Node n2) {
n=root;
n2=root2;
while(n!=null && n2!=null) {
System.out.println(n.data);
System.out.println(n2.data);
n=n.next;
n2=n2.next;
}
if(n==null && n2!=null) {
return;
}
else if(n2==null && n!=null){
return;
}
}
public void traverse(Node n) {
while(n!=null) {
System.out.println(n.data);
n=n.next;
}
}
public static void main(String args[]) {
MergeLists ml=new MergeLists();
ml.buildFirstList();
ml.buildSecondList();
ml.traverseAlt(ml.root, ml.root2);
//ml.traverse(ml.root2);
}
}
Repsalinagray, Development Support Engineer at Atmel
Hi I am Salina Gray,I live in Texas and work as a Design Team Member. I am new to ...
Repmelissamewingm, abc at ABC TECH SUPPORT
I am Melissa from Springdale. I function as an Auditing assistant in Bountiful Harvest Health Food Store. My solid interest ...
- aifra2000 April 23, 2018