celeritas
BAN USER 1of 3 votes
AnswersGiven a matrix, you need to create another matrix such that the value (i,j) is either 1, 0 or 1.
 celeritas in United States
1  if multiplication of all values in ith row and jth column is greater than 0.
1  if multiplication of all values in ith row and jth column is less than 0.
0  if multiplication of all the values in ith row and jth column is 0.
e.g.
1 2 3 1
1 0 1 2
1 1 1 1
o/p
1 0 1 1
0 0 0 0
1 0 1 1 Report Duplicate  Flag  PURGE
Amazon Software Engineer Intern Algorithm
They have just asked us to write a code to test the reverse function written to reverse a linked list.
Assume
Node * reverse(Node * head)
returns a pointer to the linked list which is reversed.
So something like, should work.
Node * reverseReverse = reverse(reverse(orig));
boolean compare(Node * orig, Node * reverseReverse)
{
Node * temp = orig; Node * temp1 = reverseReverse
if(temp == NULL & temp1 == NULL)
return true;
while(temp != NULL && temp1 != NULL)
{
if(temp>value != temp1>value)
return false;
}
if((temp != NULL && temp1 == NULL)  (temp == NULL && temp != NULL))
return false;
return true;
}

celeritas
November 10, 2013 int[] reverse(int[] A, int shifts)
{
int[] temp = new int[A.length * 2];
System.arrayCopy(A, 0, temp, 0, A.length);
System.arrayCopy(A, 0, temp, A.length, A.length);
shifts = shifts % A.length;
int[] result = new int[A.length];
System.arrayCopy(temp, shifts  1, result, 0, A.length);
}
Explanation: temp array is A + A. And temp.length = 2*A.length.
e.g. A = [4,3,2,5] then temp = [4,3,2,5,4,3,2,5].
Now select the array between (including) (shifts  1) and including shifts  1 + A.length  1.
Repwilliamland1990, Associate at Advent
Gifted in donating shaving cream worldwide. Crossed the country getting my feet wet with the elderly in Salisbury, MD. Have ...
Open Chat in New Window
We should start decomposing the problem:
 celeritas August 07, 20181. we will only store data for last 30 days in a rolling window.
2. we will have 3 (or one?) max heap data structures (one for 10 frequent words in a day, one for 10 frequent words in an hour and one for 10 frequent in a month).
3. there will be a system that maintains and stores that data.