sjain
BAN USERThere are many approach to solve this problem:
 O(N^2)  brute force match between two array.
 O(nlogn)  sort both array in O(NlogN), then compare both the list, that will take O(N)
 O(N)  if array is not too big, then store contain of first array in hashmap, then iterate through the second array and check whether number is there in the hashmap or not.
you can iterate through the list one checking inadvance with its 3 successor in the list.
if both consecutive it same, then you can discard this, similarly if three consecutive is incremental then discard them.
if you find 'A', then replace with the previous card and assume that can be discarded.
this can be done in O(n). just one iteration of the list.
boolean isBST(node root) {
if ( root == null  (root.left == null && root.right == null )) {
return true;
}
if ( root.left == null && root.right == null ) {
return true;
}
if ( root.left > root.right ) {
return false;
}
return (isBST(root.left) && isBST(root.right));
}

sjain
July 18, 2013 Thanks X for finding that out...
in that case we have a pointer to the first node from where element are going to duplicate. if temp == firstDupNode, then list is having loop.
if let say more than one elements are duplicate then we have to maintain the firstDupNode to the node which has the duplicate value as temp node.
traverse through the array.. keep multiplying all the element, and before mulitplying check whether that product is divisible by the element or not, if yes that element is duplicate.
boolean checkPrime(int []arr, int length) {
for (int i = 0; i < length; i++) {
int duplicate[length] = {0};
int j = 0;
int product = 1;
if (product % arr[i] == 0 ) {
duplicate[j++] = arr[i];
} else {
product = product * arr[i];
}
}
if ( j == 0 ) {
return false;
} else {
return true;
}
}
duplicate will contain all the duplicate prime number.
 sjain June 16, 2013this will find whether there is loop or not in sorted linked list
boolean isLooped(node *head) {
if (head == nul) {
return false;
}
if (head>next == null) {
return false;
}
node *temp = head;
while (temp>next!=null) {
if (temp>value < temp>next>value) {
return true;
}
temp = temp>next;
}
return false;
}

sjain
May 21, 2013 try it recursively..
first go to end of both the list.
from there start adding number and return the carry number.
while in each recursion add the numbers and carry number.
at the end when we reach to the first nodes i.e. the MSB of the number add these and get the carry number. if that carry number is non zero then add one more node to the head with that value.
for measuring:
 an hour
 just burn a stick. it will be totally burnt in 1 hour.
 half an hour
 burn a stick from both side, in half an hour it will be completely burnt.
 for 45 mins
 burn a stick from both side(stick1). and other stick(stick2) only one side. once stick1 is completely burnt, stop second stick to burn and start burning that stick from both side. it will again take another 15 mins. so total you can complete it in 45 mins.

sjain
March 05, 2013 to be more clear..
let say u have a,b,c,d,e.. 5 ball.
take a and b, c and d together and compare the weight between these two sets.
if both are equal so, e is heavier.
if set a and b is heavier then compare the weight between then and find the heavier one, otherwise compare the set of c and d.
have a class restReservation, which will have method as,
 tableIsEmpty( int) , will take the number of person for which emtpy table has to find, it will return 0 if all are full, otherwise table number.
 tableBookFor(int starttime, int endtime)
it will have following member,:
 array of elements.
each element will have, table number, table capacity, isBooked, int startime, int endTime,.
An IEnumerator is a thing that can enumerate: it has the MoveNext, Current, and Reset methods (which in .NET code you probably won't call explicitly, though you could).
An IEnumerable is a thing that can be enumerated...which simply means that it has a GetEnumerator method that returns an IEnumerator.
Which do you use? The only reason to use IEnumerator is if you have something that has a nonstandard way of enumerating (that is, of returning its various elements onebyone), and you need to define how that works. You'd create a new class implementing IEnumerator. But you'd still need to return that IEnumerator in an IEnumerable class.
For a look at what an enumerator (implementing IEnumerator<T>) looks like, see any Enumerator<T> class, such as the ones contained in List<T>, Queue<T>, or Stack<T>. For a look at a class implementing IEnumerable, see any standard collection class.
int multiply( int a, int b) {
if (a==0  b==0)
return 0;
int sign = 0, result;
if ((a < 0 && b > 0)  (a > 0 && b < 0)) {
sign = 1;
}
int a1 = abs(a);
int b1 = abs(b);
while (b1) {
result + = a1;
}
if (sign) {
return result/(1);
} else {
return result;
}
}

sjain
February 25, 2013
RepJohnMThomaa, Systems Design Engineer at USAA
Managed a small team writing about dust in Minneapolis, MN. Spent high school summers marketing Online vacuum pump sale New ...
Repexoticcarrental, Android Engineer
Rent your vehicle for the best price with Exotic Car Rental. We provide easy to use platform for car owners ...
Repmarkglove17, Associate at Arista Networks
Hi, I am Mark from North Edwards, CA .I am just crazy about dance.I am not professionally trained, but ...
RepA real dynamo when it comes to buying and selling carnival rides in Fort Lauderdale, FL. Spend several years working ...
RepMegan Copeland, Analyst at Airbnb
Are you looking for the most recommended Bristol wedding photography service provider? Here, Danny T is a famous wedding photographer ...
RepJames Gulledge, Dev Lead at ADP
Get you driving in comfort and class in Atlanta! Prestige Luxury Rentals offer a wide selection of premium vehicles Our ...
RepTerryDBonner, Employee at Electronic Arts
Maintained accurate personal records on maintenance crews and technical records on weekly insulation production.Have years of Installation and servicing ...
RepNY Vape Shop is the most popular Vaporizer Store for new trend vaporizer pen and all related accessories. We are ...
RepDo you want to use Kamdev Vashikaran Mantra to subdue someone?Or If you are willing to attract your love ...
solution for two array list:
 sjain November 06, 2014 O(N^2)  brute force match between two array.
 O(nlogn)  sort both array in O(NlogN), then compare both the list, that will take O(N)
 O(N)  if array is not too big, then store contain of first array in hashmap, then iterate through the second array and check whether number is there in the hashmap or not.
for N integer array , take two array and use above solution, then create a new array with the intersection then use that with next array to find intersection.
repeat the steps till all array is covered.